Top Description Interfaces Annotations Classes Enums
[default module]

Package com.google.common.cache

Annotations
@CheckReturnValue
@ParametersAreNonnullByDefault
Imports
com.google.errorprone.annotations.CheckReturnValue, javax.annotation.ParametersAreNonnullByDefault

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

Modifier and TypeInterface and Description
public interface
Cache<
the type of the cache's keys, which are not permitted to be null
K
,
the type of the cache's values, which are not permitted to be null
V
>

A semi-persistent mapping from keys to values.

public interface
LoadingCache<
the type of the cache's keys, which are not permitted to be null
K
,
the type of the cache's values, which are not permitted to be null
V
>

A semi-persistent mapping from keys to values.

pack-priv interface
LongAddable

Abstract interface for objects that can concurrently add longs.

pack-priv interface
ReferenceEntry<K, V>

An entry in a reference map.

public interface
RemovalListener<
the most general type of keys this listener can listen for; for example Object if any key is acceptable
K
,
the most general type of values this listener can listen for; for example Object if any key is acceptable
V
>

An object that can receive a notification when an entry is removed from a cache.

public interface
Weigher<K, V>

Calculates the weights of cache entries.

Annotation Summary

Modifier and TypeAnnotation and Description
pack-priv @interface
ElementTypesAreNonnullByDefault

Marks all "top-level" types as non-null in a way that is recognized by Kotlin.

pack-priv @interface
ParametricNullness

Annotates a "top-level" type-variable usage that takes its nullness from the type argument supplied by the user of the class.

Class Summary

Modifier and TypeClass and Description
public abstract class
AbstractCache<K, V>

This class provides a skeletal implementation of the Cache interface to minimize the effort required to implement this interface.

public abstract class
AbstractLoadingCache<K, V>

This class provides a skeletal implementation of the Cache interface to minimize the effort required to implement this interface.

public class
CacheBuilder<
the most general key type this builder will be able to create caches for. This is normally Object unless it is constrained by using a method like #removalListener. Cache keys may not be null.
K
,
the most general value type this builder will be able to create caches for. This is normally Object unless it is constrained by using a method like #removalListener. Cache values may not be null.
V
>

A builder of LoadingCache and Cache instances.

public class
CacheBuilderSpec

A specification of a CacheBuilder configuration.

public abstract class
CacheLoader<K, V>

Computes or retrieves values, based on a key, for use in populating a LoadingCache.

public class
CacheStats

Statistics about the performance of a Cache.

public abstract class
ForwardingCache<K, V>

A cache which forwards all its method calls to another cache.

public abstract class
ForwardingLoadingCache<K, V>

A cache which forwards all its method calls to another cache.

pack-priv class
LocalCache<K, V>

The concurrent hash map implementation built by CacheBuilder.

pack-priv class
LongAddables

Source of LongAddable objects that deals with GWT, Unsafe, and all that.

pack-priv class
LongAdder

One or more variables that together maintain an initially zero long sum.

public class
RemovalListeners

A collection of common removal listeners.

public class
RemovalNotification<K, V>

A notification of the removal of a single entry.

pack-priv abstract class
Striped64

A package-local class holding common representation and mechanics for classes supporting dynamic striping on 64bit values.

Enum Summary

Modifier and TypeEnum and Description
public enum
RemovalCause

The reason why a cached entry was removed.