Cached object refresh #330
-
Hey, There might be a way to support this but I am struggling to find it, and I have idea for working around it but it's not my ideal. I have a cache that is holding object that currently have a 10 min expiry these object are either in a completed or in progress state. Ideally I would leave the timeout at 10 mins (possibly even reduce it) but when the object expires check the state, if it's still in progress re cache/extend the duration of the object in the cache. I have looked at the docs for plugins and events but and implemented something that looks like it might work but I'm a bit unclear on a few things.
Thank you in advance to anyone who can advice on this. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I look at the code and I think I answered some of my questions;
|
Beta Was this translation helpful? Give feedback.
-
Hi @jacob7395 , that was fast 😅
if I got this right you may use Conditional Refresh but without the ETag part: basically you can look at You can also adapt the Of course all the other features of FusionCache like fail-safe, soft timeouts, eager refresh and so on will keep working as usual, so you can mix them together as you like. Hope this helps, let me know. |
Beta Was this translation helpful? Give feedback.
Hi @jacob7395 , that was fast 😅
if I got this right you may use Conditional Refresh but without the ETag part: basically you can look at
ctx.StaleValue
, do your own check on the progress, and if you need to cache the same thing for a little bit more you can just returnctx.NotModified()
.You can also adapt the
Duration
or other options based on your own logic thanks to Adaptive Caching, if you like.Of course all the other features of FusionCache like fail-safe, soft timeouts, eager refresh …