0

I'd like to effectively implement a "soft expiry" using Hazelcast, where if an entry was beyond a certain age, it would still be considered a cache hit and returned, but it would be asynchronously reloaded after being requested (effectively, the behaviour implemented in Guava/Caffeine's Refresh operation: https://github.com/ben-manes/caffeine/wiki/Refresh)

Hazelcast IMDG doesn't seem to offer this functionality out-of-the-box. What options do I have for implementing this?


In particular, I'm interested in whether it's possible to easily implement a loader such that if the entry is missing, it will first check a database, and if the database doesn't contain a match, it'll call an API. Then the write-through behaviour should write the result of the API call back to the database and put it into the Hazelcast map.

Chris Cooper
  • 869
  • 2
  • 18
  • 42
  • I am afraid there is no such functionality out of the box. With OOTB functionality you can set eviction policy or TLL and next time the cache is accessed it can load the value via a MapLoader from an external source – Orçun Çolak Aug 31 '23 at 05:38

0 Answers0