http-cache icon indicating copy to clipboard operation
http-cache copied to clipboard

How to manually handle cache expiration?

Open xiaohucode opened this issue 1 year ago • 5 comments

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

xiaohucode avatar Jan 22 '24 17:01 xiaohucode

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.

06chaynes avatar Jan 22 '24 19:01 06chaynes

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.

xiaohucode avatar Jan 23 '24 09:01 xiaohucode

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

06chaynes avatar Jan 23 '24 14:01 06chaynes

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

xiaohucode avatar Jan 23 '24 15:01 xiaohucode

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.

06chaynes avatar Jan 23 '24 21:01 06chaynes