@CheckReturnValue @NullMarked
Package com.google.common.cache
Discouraged (in favor of Caffeine) caching utilities.
The core interface used to represent caches is Cache
. In-memory caches can be
configured and created using CacheBuilder
, with cache entries being loaded by CacheLoader
. Statistics about cache performance are exposed using CacheStats
.
See the Guava User Guide article on caches.
This package is a part of the open-source Guava library.
- Author:
- Charles Fry
-
Interface Summary Interface Description AbstractCache.StatsCounter Accumulates statistics during the operation of aCache
for presentation byCache.stats()
.Cache<K,V> A semi-persistent mapping from keys to values.LoadingCache<K,V> A semi-persistent mapping from keys to values.RemovalListener<K,V> An object that can receive a notification when an entry is removed from a cache.Weigher<K,V> Calculates the weights of cache entries. -
Class Summary Class Description AbstractCache<K,V> This class provides a skeletal implementation of theCache
interface to minimize the effort required to implement this interface.AbstractCache.SimpleStatsCounter A thread-safeAbstractCache.StatsCounter
implementation for use byCache
implementors.AbstractLoadingCache<K,V> This class provides a skeletal implementation of theCache
interface to minimize the effort required to implement this interface.CacheBuilder<K,V> A builder ofLoadingCache
andCache
instances.CacheBuilderSpec A specification of aCacheBuilder
configuration.CacheLoader<K,V> Computes or retrieves values, based on a key, for use in populating aLoadingCache
.CacheStats Statistics about the performance of aCache
.ForwardingCache<K,V> A cache which forwards all its method calls to another cache.ForwardingCache.SimpleForwardingCache<K,V> A simplified version ofForwardingCache
where subclasses can pass in an already constructedCache
as the delegate.ForwardingLoadingCache<K,V> A cache which forwards all its method calls to another cache.ForwardingLoadingCache.SimpleForwardingLoadingCache<K,V> A simplified version ofForwardingLoadingCache
where subclasses can pass in an already constructedLoadingCache
as the delegate.RemovalListeners A collection of common removal listeners.RemovalNotification<K,V> A notification of the removal of a single entry. -
Enum Summary Enum Description RemovalCause The reason why a cached entry was removed. -
Exception Summary Exception Description CacheLoader.InvalidCacheLoadException Thrown to indicate that an invalid response was returned from a call toCacheLoader
.CacheLoader.UnsupportedLoadingOperationException Exception thrown byloadAll()
to indicate that it is not supported.