Closed mehrdad2000 closed 9 months ago
Caffeine can be integrated with one, but does not provide a remote cache functionality.
A Cache.get
can use a CacheLoader
or a mapping function to fetch the entry atomically. That can load from your remote cache prior to the system of record (e.g. memcached else db). Relatedly, a refresh can call this for reloading proactively before a popular entry expires.
The asMap().compute
methods let you write into the cache and a secondary store. This way your mapping function can update both caches if desired.
How you broadcast the invalidation, the remote cache topology, etc. is your application's decision.
Caffeine was adopted as the local cache by Oracle Coherence. Redhat Infinispan, and Redisson. Those are separate projects that manage their stack. Many do it themselves as described above, such as in this recent DoorDash article or as like Twitter's CaffeineMemcacheClient.
Hi Does Caffeine support remote cache?
Thanks