-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Absolute expiration time is not preserved during recovering from distributed cache to in-memory cache #53
Comments
Hi @yzhoholiev , and thanks for considering FusionCache! |
Hi @yzhoholiev , sorry for the delay but after 2 years covid finally got me 🤒. Anyway I've looked more into this, and here are some random things I'm thinking about:
The thing is not super straightforward when considering all possibilities, since it involves all possible cases of entries that are from memory or distributed, that are fresh or stale, that are with or without fail-safe enabled, etc... I'll take some more time to marinate all these thoughts, experiment with some changes and will come back to you as soon as possible. |
Hi @yzhoholiev , I just pushed a change that should fix what you reported. A couple of notes regarding the change:
This allows us to have a more precise local expiration in case an entry is coming from the distributed cache, on top of not consuming more memory in case there's no distributed cache involved. Please let me know what you think: in case everything looks good also to you, I'll push a new release asap. Thanks! |
Hi @yzhoholiev , I just saw your 👍 reaction: just so I know what to do, the thumbs up was like "ok I'll take a look at that and let you know" (so I'll wait) or "I looked at that and it is good to me" (so I move on and release a new version)? |
@jodydonetti sorry for the uncertainty. We will spend some time testing the implementation. |
Got it, thanks! |
The fix seems to be working! |
Awesome, thanks for testing it! |
Hey @yzhoholiev , I just released v0.13.0 which contains this fix, hope this helps. Closing this issue. |
The current implementation does not take into account the
AbsolutExpiration
set during the addition of the entry to the IDistributeCachehttps://github.com/jodydonetti/ZiggyCreatures.FusionCache/blob/f1380b7c562eeb610c58490fd7e7f63bf69e0569/src/ZiggyCreatures.FusionCache/FusionCache_Sync.cs#L145
This may lead to the hidden extension of the lifetime of the entry (especially for the
TryGet[Async]
method).As
IDistributedCache
does not return back the expiration time, it's possible to extend theMetadata
payload with the calculated absolute expiration and use it during the creation of the entry in the in-memory cache.Also, it is worth reflecting in the documentation that the current implementation uses
FusionCacheEntryOptions
for the restored entires.The text was updated successfully, but these errors were encountered: