-
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
Expire after time and a succesful retrieval #501
Comments
I'm not sure that I follow. Expiration is a hard cutoff for when an entry can no longer be used because its data may be too old (e.g. freshness, inactivity). The cache can then discard it to reclaim space. Refresh might be more appropriate. This will return the existing value but, if it is older than the duration, a reload will occur asynchronously. That hides latency by not penalizing the caller with the load. When combined with expiration, the refresh keeps active content fresh and inactive content is discarded automatically. These rules are time-based. Would refresh serve your needs? |
Closing due to lack of clarification. |
Sorry about that Ben, but refresh looks exactly what we need. Thank you! |
@ben-manes Looking into this a little further, I noticed there is not a similar api as new Expiry() to create a custom expiration. We have our data in two different states, that we would like to refresh at a different times. This is possible with eviction, but doesn't seem possible with refresh unless I am missing something. Is my understanding correct? |
Unfortunately that is not supported yet. The feature is described in #504 but no work has started yet. |
So currently we are using caffeine to store an item for 2 minutes very successfully.
Our implementation is basically:
We had an issue where the service retrieveSchema calls failed, so we no longer had the item. So I am wondering is there a way to set it so it won't expire until 2 minutes after creation and another retrieval occurs? We would rather use a more stale schema then no schema, so wondering if this is possible.
The text was updated successfully, but these errors were encountered: