You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use Caffeine to store responses of a slow API that can take a few seconds to respond.
I understand that Caffeine does not have native support for proactively refreshing items in the refresh window. I want to implement this approach in my code, but I only want to refresh the items accessed at least once after they were added.
What is the suggested way of retrieving information that an item has been accessed after it has been created or updated?
By setting both expireAfterWrite and expireAfterAccess, I can get the write and read time of an item with FixedExpiration.ageOf and see if they are different.
Is this a good approach? I understand that setting both of these values is not the best and may not be supported in the future Variable refresh #504, [Feature Request] Time-based Refresh #261 (comment)
Currently I am setting expireAfter with custom Expiry policy. I see no way to get this information in this case. Is there any?
Is there any other way not related to the expiration policy?
BTW. Thanks for this great library and your support!
The text was updated successfully, but these errors were encountered:
The cache will try to hold minimal metadata, so if it wasn't required then we'll drop it to save memory. For example the expireAfter only maintains a single duration and not the create / read / update times.
You can always add your own metadata by wrapping your type to add a timestamp or two. You can set those as atomic fields to read and write from, such as on access or write. I suspect this will be easier than trying to use our metadata when it's not a straightforward match and lets you modify the policies if your goals diverge (such as if you want to not use access time for the expiration policy).
I use Caffeine to store responses of a slow API that can take a few seconds to respond.
I understand that Caffeine does not have native support for proactively refreshing items in the refresh window. I want to implement this approach in my code, but I only want to refresh the items accessed at least once after they were added.
What is the suggested way of retrieving information that an item has been accessed after it has been created or updated?
expireAfterWrite
andexpireAfterAccess
, I can get the write and read time of an item withFixedExpiration.ageOf
and see if they are different.Is this a good approach? I understand that setting both of these values is not the best and may not be supported in the future Variable refresh #504, [Feature Request] Time-based Refresh #261 (comment)
expireAfter
with customExpiry
policy. I see no way to get this information in this case. Is there any?BTW. Thanks for this great library and your support!
The text was updated successfully, but these errors were encountered: