Class ChronicleMapCache

java.lang.Object
se.liu.ida.hefquin.federation.access.impl.cache.CacheLayer<PersistentCacheKey,CompletableFuture<? extends DataRetrievalResponse<?>>,PersistentCacheEntry>
se.liu.ida.hefquin.federation.access.impl.cache.chroniclemap.ChronicleMapCache
All Implemented Interfaces:
AutoCloseable, Cache<PersistentCacheKey,CompletableFuture<? extends DataRetrievalResponse<?>>>

public class ChronicleMapCache extends CacheLayer<PersistentCacheKey,CompletableFuture<? extends DataRetrievalResponse<?>>,PersistentCacheEntry>
Persistent cache backed by a ChronicleMap.

This class is thread-safe for concurrent access through its public methods on a single ChronicleMapCache instance. All access is guarded by synchronization on map.

Cache entry creation, invalidation, and replacement behavior are delegated to the configured cache policies.

The cache enforces a maximum capacity. If the persisted map contains more entries than allowed when opened, entries are evicted according to the configured replacement policy until the capacity constraint is satisfied.

Caveats:

Thread safety is provided only at the level of this cache instance. If two ChronicleMapCache objects point to the same persisted file, this class does not coordinate:

  • replacement policy state
  • capacity enforcement
  • invalidation/eviction decisions