06chaynes / http-cache

A caching middleware that follows HTTP caching rules
https://http-cache.rs/
Apache License 2.0
69 stars 17 forks source link

How to manually handle cache expiration? #69

Open xiaohucode opened 10 months ago

xiaohucode commented 10 months ago

use [CacheMode::IgnoreRules] How to manually handle cache expiration

06chaynes commented 10 months ago

Each CacheManager implementation has a delete method you can use to manually delete a cache record by key. You could also potentially add cache bust logic to return a list of cache keys to remove under specified conditions.

xiaohucode commented 10 months ago

Each CacheManager implementation has a delete method you can use to manually delete a cache record by key. You could also potentially add cache bust logic to return a list of cache keys to remove under specified conditions.

Is it possible to add a maximum expiration time? It is used to control response expiration.

06chaynes commented 10 months ago

I would think it should be possible to add such logic in your application

xiaohucode commented 10 months ago

I would think it should be possible to add such logic in your application

I added a max_ Stale Is this feasible?

https://github.com/xiaohucode/http-cache/commit/f346d0304b9a2f5eb2942d75cc6a5e3cf479e368

06chaynes commented 10 months ago

i think so but I would want to make a few changes first, if you'd like to open a PR we can work through that there.