Package io.github.oberhoff.distributedcaffeine
This package contains the main classes and interfaces for configuring, constructing and using Distributed Caffeine
cache instances.
Distributed Caffeine is a Caffeine
-based distributed cache using MongoDB
change streams for near real-time synchronization between multiple cache instances, especially across different
machines.
Cache instances can be configured and constructed using a builder returned by
DistributedCaffeine.newBuilder(MongoCollection)
. A cache instance can
be of type DistributedCache
(extends
Cache
) or of type
DistributedLoadingCache
(extends
LoadingCache
).
Attention: To ensure the integrity of distributed synchronization between cache instances, the following minor restrictions apply:
- Reference-based eviction using Caffeine's weak or soft references for keys or values is not supported. Even for the use of Caffeine (stand-alone), it is advised to use the more predictable size- or time-based eviction instead.
-
Interface Summary Interface Description DistributedCache<K,V> Interface representing a cache instance.DistributedLoadingCache<K,V> Interface representing a loading cache instance.DistributedPolicy<K,V> Interface representing an access point for inspecting and performing low-level operations on the cache instance (similar toPolicy
).DistributedPolicy.CacheEntry<K,V> Interface representing a cache entry containing key and value along with some metadata. -
Class Summary Class Description DistributedCaffeine<K,V> Distributed Caffeine is aCaffeine
-based distributed cache using MongoDB change streams for near real-time synchronization between multiple cache instances, especially across different machines.DistributedCaffeine.Builder<K,V> Builder for configuring and constructing cache instances of typeDistributedCache
(extendsCache
) or of typeDistributedLoadingCache
(extendsLoadingCache
). -
Enum Summary Enum Description DistributionMode Modes for defining the scope of distributed synchronization. -
Exception Summary Exception Description DistributedCaffeineException Unchecked runtime exception thrown by cache instances.