-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Different behavior from expireAfter and expireAfterWrite #1745
Comments
Offhand it looks fine to me as well. If you could work on a reproducer, e.g. using |
Thanks, I will try to do a real reproduction. I don't think it's that bug (we use |
One difference is that You might also be interested in |
As is typically the case when somebody opens an issue with a random snippet of unedited code, the problem was not in anything I showed you — or it was sort of there but not really correctly. My caches are all created with values of type |
(I apologize — this is not a great bug report in that it is not a self-contained reproduction, and it's in Kotlin. But perhaps there's something blatantly obvious we are doing wrong.)
We have a cache that we set up with this configuration:
(
10.minutes
uses a Kotlin extension function that returns a Duration for 10 minutes.)We use this cache in an app that calls
get()
on the cache once a minute for a few hundred keys (the same keys each minute). We see that the underlyingloader
is called on every key once every ten minutes.We want to spread this out, so we want to jitter the expiration. So we do this:
When we run this, we expect to see our loader called for each key every 5 to 15 minutes, but instead it seems to never call it after the initial call.
Are we confused about how to implement Expiry? We are modeling this after
Expiry.creating
. We are using Caffeine v3.10.0 (we should upgrade, butExpiry.creating
does not appear to be in any released version anyway).The text was updated successfully, but these errors were encountered: