@DefaultQualifier(value=org.checkerframework.checker.nullness.qual.NonNull.class,locations=FIELD) @DefaultQualifier(value=org.checkerframework.checker.nullness.qual.NonNull.class,locations=PARAMETER) @DefaultQualifier(value=org.checkerframework.checker.nullness.qual.NonNull.class,locations=RETURN)
Package com.github.benmanes.caffeine.cache
Caffeine
builder.
A Cache
provides similar characteristics as
ConcurrentHashMap
with additional support for policies to bound the
map by. When built with a CacheLoader
, the LoadingCache
variant allows the cache
to populate itself on miss and offers refresh capabilities.
A AsyncCache
is similar to a Cache
except that a cache entry holds a
CompletableFuture
of the value. This entry will be automatically
removed if the future fails, resolves to null
, or based on an eviction policy. When built
with a AsyncCacheLoader
, the AsyncLoadingCache
variant allows the cache to
populate itself on miss and offers refresh capabilities.
Additional functionality such as bounding by the entry's size, removal notifications, statistics,
and eviction policies are described in the Caffeine
builder.
-
Interface Summary Interface Description AsyncCache<K,V> A semi-persistent mapping from keys to values.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.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
.Expiry<K,V> Calculates when cache entries expire.LoadingCache<K,V> A semi-persistent mapping from keys to values.Policy<K,V> An access point for inspecting and performing low-level operations based on the cache's runtime characteristics.Policy.CacheEntry<K,V> A key-value pair that may include policy metadata for the cached entry.Policy.Eviction<K,V> The low-level operations for a cache with a size-based eviction policy.Policy.FixedExpiration<K,V> The low-level operations for a cache with a fixed expiration policy.Policy.FixedRefresh<K,V> The low-level operations for a cache with a fixed refresh policy.Policy.VarExpiration<K,V> The low-level operations for a cache with a variable expiration policy.RemovalListener<K,V> An object that can receive a notification when an entry is removed from a cache.Scheduler A scheduler that submits a task to an executor after a given delay.Ticker A time source that returns a time value representing the number of nanoseconds elapsed since some fixed but arbitrary point in time.Weigher<K,V> Calculates the weights of cache entries. -
Class Summary Class Description Caffeine<K,V> A builder ofCache
,LoadingCache
,AsyncCache
, andAsyncLoadingCache
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 statisticsCaffeineSpec A specification of aCaffeine
builder configuration. -
Enum Summary Enum Description RemovalCause The reason why a cached entry was removed.