Package com.github.benmanes.caffeine.cache
package com.github.benmanes.caffeine.cache
This package contains caching utilities.
The core interface used to represent caches is Cache
.
A cache may be specialized as either a LoadingCache
or AsyncLoadingCache
.
In-memory caches can be configured and created using
Caffeine
. The cache entries may be loaded by
CacheLoader
, weighed by
Weigher
, and on removal forwarded to
RemovalListener
. Statistics about cache performance
are exposed using CacheStats
.
-
ClassDescriptionThis class provides a skeletal implementation of the
LinkedDeque
interface to minimize the effort required to implement this interface.AccessOrderDeque<E extends AccessOrderDeque.AccessOrder<E>>A linked deque implementation used to represent an access-order queue.AccessOrderDeque.AccessOrder<T extends AccessOrderDeque.AccessOrder<T>>An element that is linked on theDeque
.Static utility methods and classes pertaining to asynchronous operations.A removal listener that asynchronously forwards the value stored in aCompletableFuture
if successful to the user-supplied removal listener.Async.AsyncWeigher<K,V> A weigher for asynchronous computations.AsyncCacheLoader<K,V> Computes or retrieves values asynchronously, based on a key, for use in populating aAsyncLoadingCache
.AsyncLoadingCache<K,V> A semi-persistent mapping from keys to values.The namespace for field padding through inheritance.Enforces a memory layout to avoid false sharing by padding the write count.Enforces a memory layout to avoid false sharing by padding the read count.The namespace for field padding through inheritance.Enforces a memory layout to avoid false sharing by padding the drain status.A striped, non-blocking, bounded buffer.BoundedLocalCache<K,V> An in-memory cache implementation that supports full concurrency of retrievals, a high expected concurrency for updates, and multiple ways to bound the cache.An adapter to safely externalize the entry iterator.An adapter to safely externalize the entries.An adapter to safely externalize the entry spliterator.An adapter to safely externalize the key iterator.An adapter to safely externalize the keys.An adapter to safely externalize the key spliterator.An adapter to safely externalize the value iterator.An adapter to safely externalize the value spliterator.An adapter to safely externalize the values.BoundedWeigher<K,V> Buffer<E>A multiple-producer / single-consumer buffer that rejects new elements if it is full or fails spuriously due to contention.Cache<K,V> A semi-persistent mapping from keys to values.CacheLoader<K,V> Computes or retrieves values, based on a key, for use in populating aLoadingCache
orAsyncLoadingCache
.CacheWriter<K,V> Communicates the write or deletion of a value, based on a key, to an external resource.Caffeine<K,V> A builder ofAsyncLoadingCache
,LoadingCache
, andCache
instances having a combination of the following features: automatic loading of entries into the cache, optionally asynchronously size-based eviction when a maximum is exceeded based on frequency and recency time-based expiration of entries, measured since last access or last write asynchronously refresh when the first stale request for an entry occurs keys automatically wrapped in weak references values automatically wrapped in weak or soft references writes propagated to an external resource notification of evicted (or otherwise removed) entries accumulation of cache access statisticsA specification of aCaffeine
builder configuration.A probabilistic multiset for estimating the popularity of an element within a time window.LinkedDeque<E>A linked list extension of theDeque
interface where the link pointers are tightly integrated with the element.LoadingCache<K,V> A semi-persistent mapping from keys to values.This class provides a skeletal implementation of theAsyncLoadingCache
interface to minimize the effort required to implement aLocalCache
.LocalCache<K,V> An in-memory cache providing thread safety and atomicity guarantees.WARNING: GENERATED CODE A factory for caches optimized for a particular configuration.LocalCacheFactory.SI<K,V> LocalCacheFactory.SS<K,V> LocalCacheFactory.WI<K,V> LocalCacheFactory.WS<K,V> This class provides a skeletal implementation of theLoadingCache
interface to minimize the effort required to implement aLocalCache
.This class provides a skeletal implementation of theCache
interface to minimize the effort required to implement aLocalCache
.An MPSC array queue which starts at initialCapacity and grows to maxCapacity in linked chunks of the initial size.Node<K,V> An entry in the cache containing the key, value, weight, access, and write metadata.WARNING: GENERATED CODE A factory for cache nodes optimized for a particular configuration.NodeFactory.SSo<K,V> NodeFactory.SSoA<K,V> NodeFactory.SSoAMS<K,V> NodeFactory.SSoAMW<K,V> NodeFactory.SSoAR<K,V> NodeFactory.SSoARMS<K,V> NodeFactory.SSoARMW<K,V> NodeFactory.SSoAW<K,V> NodeFactory.SSoAWMS<K,V> NodeFactory.SSoAWMW<K,V> NodeFactory.SSoAWR<K,V> NodeFactory.SSoAWRMS<K,V> NodeFactory.SSoAWRMW<K,V> NodeFactory.SSoMS<K,V> NodeFactory.SSoMW<K,V> NodeFactory.SSoR<K,V> NodeFactory.SSoRMS<K,V> NodeFactory.SSoRMW<K,V> NodeFactory.SSoW<K,V> NodeFactory.SSoWMS<K,V> NodeFactory.SSoWMW<K,V> NodeFactory.SSoWR<K,V> NodeFactory.SSoWRMS<K,V> NodeFactory.SSoWRMW<K,V> NodeFactory.SSt<K,V> NodeFactory.SStA<K,V> NodeFactory.SStAMS<K,V> NodeFactory.SStAMW<K,V> NodeFactory.SStAR<K,V> NodeFactory.SStARMS<K,V> NodeFactory.SStARMW<K,V> NodeFactory.SStAW<K,V> NodeFactory.SStAWMS<K,V> NodeFactory.SStAWMW<K,V> NodeFactory.SStAWR<K,V> NodeFactory.SStAWRMS<K,V> NodeFactory.SStAWRMW<K,V> NodeFactory.SStMS<K,V> NodeFactory.SStMW<K,V> NodeFactory.SStR<K,V> NodeFactory.SStRMS<K,V> NodeFactory.SStRMW<K,V> NodeFactory.SStW<K,V> NodeFactory.SStWMS<K,V> NodeFactory.SStWMW<K,V> NodeFactory.SStWR<K,V> NodeFactory.SStWRMS<K,V> NodeFactory.SStWRMW<K,V> NodeFactory.SW<K,V> NodeFactory.SWA<K,V> NodeFactory.SWAMS<K,V> NodeFactory.SWAMW<K,V> NodeFactory.SWAR<K,V> NodeFactory.SWARMS<K,V> NodeFactory.SWARMW<K,V> NodeFactory.SWAW<K,V> NodeFactory.SWAWMS<K,V> NodeFactory.SWAWMW<K,V> NodeFactory.SWAWR<K,V> NodeFactory.SWAWRMS<K,V> NodeFactory.SWAWRMW<K,V> NodeFactory.SWMS<K,V> NodeFactory.SWMW<K,V> NodeFactory.SWR<K,V> NodeFactory.SWRMS<K,V> NodeFactory.SWRMW<K,V> NodeFactory.SWW<K,V> NodeFactory.SWWMS<K,V> NodeFactory.SWWMW<K,V> NodeFactory.SWWR<K,V> NodeFactory.SWWRMS<K,V> NodeFactory.SWWRMW<K,V> NodeFactory.WSo<K,V> NodeFactory.WSoA<K,V> NodeFactory.WSoAMS<K,V> NodeFactory.WSoAMW<K,V> NodeFactory.WSoAR<K,V> NodeFactory.WSoARMS<K,V> NodeFactory.WSoARMW<K,V> NodeFactory.WSoAW<K,V> NodeFactory.WSoAWMS<K,V> NodeFactory.WSoAWMW<K,V> NodeFactory.WSoAWR<K,V> NodeFactory.WSoAWRMS<K,V> NodeFactory.WSoAWRMW<K,V> NodeFactory.WSoMS<K,V> NodeFactory.WSoMW<K,V> NodeFactory.WSoR<K,V> NodeFactory.WSoRMS<K,V> NodeFactory.WSoRMW<K,V> NodeFactory.WSoW<K,V> NodeFactory.WSoWMS<K,V> NodeFactory.WSoWMW<K,V> NodeFactory.WSoWR<K,V> NodeFactory.WSoWRMS<K,V> NodeFactory.WSoWRMW<K,V> NodeFactory.WSt<K,V> NodeFactory.WStA<K,V> NodeFactory.WStAMS<K,V> NodeFactory.WStAMW<K,V> NodeFactory.WStAR<K,V> NodeFactory.WStARMS<K,V> NodeFactory.WStARMW<K,V> NodeFactory.WStAW<K,V> NodeFactory.WStAWMS<K,V> NodeFactory.WStAWMW<K,V> NodeFactory.WStAWR<K,V> NodeFactory.WStAWRMS<K,V> NodeFactory.WStAWRMW<K,V> NodeFactory.WStMS<K,V> NodeFactory.WStMW<K,V> NodeFactory.WStR<K,V> NodeFactory.WStRMS<K,V> NodeFactory.WStRMW<K,V> NodeFactory.WStW<K,V> NodeFactory.WStWMS<K,V> NodeFactory.WStWMW<K,V> NodeFactory.WStWR<K,V> NodeFactory.WStWRMS<K,V> NodeFactory.WStWRMW<K,V> NodeFactory.WW<K,V> NodeFactory.WWA<K,V> NodeFactory.WWAMS<K,V> NodeFactory.WWAMW<K,V> NodeFactory.WWAR<K,V> NodeFactory.WWARMS<K,V> NodeFactory.WWARMW<K,V> NodeFactory.WWAW<K,V> NodeFactory.WWAWMS<K,V> NodeFactory.WWAWMW<K,V> NodeFactory.WWAWR<K,V> NodeFactory.WWAWRMS<K,V> NodeFactory.WWAWRMW<K,V> NodeFactory.WWMS<K,V> NodeFactory.WWMW<K,V> NodeFactory.WWR<K,V> NodeFactory.WWRMS<K,V> NodeFactory.WWRMW<K,V> NodeFactory.WWW<K,V> NodeFactory.WWWMS<K,V> NodeFactory.WWWMW<K,V> NodeFactory.WWWR<K,V> NodeFactory.WWWRMS<K,V> NodeFactory.WWWRMW<K,V> A non-reentrant mutual exclusionLock
.A non-fair lock using AQS state to represent if the lock is held.Policy<K,V> An access point for inspecting and performing low-level operations based on the cache's runtime characteristics.Policy.Eviction<K,V> The low-level operations for a cache with a size-based eviction policy.Policy.Expiration<K,V> The low-level operations for a cache with a expiration policy.Static utility methods and classes pertaining to weak and soft references.A weak or soft reference that includes the entry's key reference.A short-lived adapter used for looking up an entry in the cache where the keys are weakly held.The value in a cache that holds values softly.The key in a cache that holds keys weakly.The value in a cache that holds values weakly.The reason why a cached entry was removed.RemovalListener<K,V> An object that can receive a notification when an entry is removed from a cache.SerializationProxy<K,V> Serializes the configuration of the cache, reconsitituting it as aCache
,LoadingCache
, orAsyncLoadingCache
usingCaffeine
upon deserialization.A base class providing the mechanics for supporting dynamic striping of bounded buffers.A time source that returns a time value representing the number of nanoseconds elapsed since some fixed but arbitrary point in time.UnboundedLocalCache<K,V> An in-memory cache that has no capabilities for bounding the map.An adapter to safely externalize the entry iterator.An adapter to safely externalize the entries.An adapter to safely externalize the entry spliterator.An adapter to safely externalize the key iterator.An adapter to safely externalize the keys.An eviction policy that supports no boundings.An adapter to safely externalize the value iterator.An adapter to safely externalize the values.A concurrent access enabling class used by circular array based queues this class exposes an offset computation method along with differently memory fenced load/store methods into the underlying array.Weigher<K,V> Calculates the weights of cache entries.WriteOrderDeque<E extends WriteOrderDeque.WriteOrder<E>>A linked deque implementation used to represent a write-order queue.WriteOrderDeque.WriteOrder<T extends WriteOrderDeque.WriteOrder<T>>An element that is linked on theDeque
.WriteThroughEntry<K,V> An entry that allows updates to write through to the backing map.