Top Description Constructors Methods
com.github.benmanes.caffeine.guava

public final Class CaffeinatedGuava

extends Object
Class Inheritance
Imports
java.lang.reflect.Method, com.github.benmanes.caffeine.cache.Caffeine, com.github.benmanes.caffeine.guava.CaffeinatedGuavaLoadingCache.ExternalBulkLoader, .CaffeinatedGuavaLoadingCache.ExternalSingleLoader, .CaffeinatedGuavaLoadingCache.InternalBulkLoader, .CaffeinatedGuavaLoadingCache.InternalSingleLoader, com.google.common.cache.Cache, .CacheLoader, .LoadingCache

Static utility methods pertaining to adapting between Caffeine and Guava cache interfaces.
Author
[email protected] (Ben Manes)

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <K, V, K1 extends K, V1 extends V> Cache<K1, V1>

Returns:

a cache exposed under the Guava APIs
build
(Caffeine<K, V>
the configured cache builder
builder
)

Returns a Caffeine cache wrapped in a Guava Cache facade.

public static <K, V, K1 extends K, V1 extends V> LoadingCache<K1, V1>

Returns:

a cache exposed under the Guava APIs
build
(Caffeine<K, V>
the configured cache builder
builder
,
CacheLoader<? super K1, V1>
the cache loader used to obtain new values
loader
)

Returns a Caffeine cache wrapped in a Guava LoadingCache facade.

public static <K, V, K1 extends K, V1 extends V> LoadingCache<K1, V1>

Returns:

a cache exposed under the Guava APIs
build
(Caffeine<K, V>
the configured cache builder
builder
,
CacheLoader<? super K1, V1>
the cache loader used to obtain new values
loader
)

Returns a Caffeine cache wrapped in a Guava LoadingCache facade.

public static <K, V> CacheLoader<K, V>

Returns:

a cache loader exposed under the Caffeine APIs
caffeinate
(CacheLoader<K, V>
the cache loader used to obtain new values
loader
)

Returns a Caffeine cache loader that delegates to a Guava cache loader.

pack-priv static boolean
hasLoadAll(CacheLoader<?, ?> cacheLoader)

pack-priv static boolean
hasMethod(CacheLoader<?, ?> cacheLoader, String name, Class<?>... paramTypes)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CaffeinatedGuavaback to summary
private CaffeinatedGuava()

Method Detail

buildback to summary
public static <K, V, K1 extends K, V1 extends V> Cache<K1, V1> build(Caffeine<K, V> builder)

Returns a Caffeine cache wrapped in a Guava Cache facade.

Parameters
builder:Caffeine<K, V>

the configured cache builder

Returns:Cache<K1, V1>

a cache exposed under the Guava APIs

buildback to summary
public static <K, V, K1 extends K, V1 extends V> LoadingCache<K1, V1> build(Caffeine<K, V> builder, CacheLoader<? super K1, V1> loader)

Returns a Caffeine cache wrapped in a Guava LoadingCache facade.

Parameters
builder:Caffeine<K, V>

the configured cache builder

loader:CacheLoader<? super K1, V1>

the cache loader used to obtain new values

Returns:LoadingCache<K1, V1>

a cache exposed under the Guava APIs

buildback to summary
public static <K, V, K1 extends K, V1 extends V> LoadingCache<K1, V1> build(Caffeine<K, V> builder, CacheLoader<? super K1, V1> loader)

Returns a Caffeine cache wrapped in a Guava LoadingCache facade.

Parameters
builder:Caffeine<K, V>

the configured cache builder

loader:CacheLoader<? super K1, V1>

the cache loader used to obtain new values

Returns:LoadingCache<K1, V1>

a cache exposed under the Guava APIs

caffeinateback to summary
public static <K, V> CacheLoader<K, V> caffeinate(CacheLoader<K, V> loader)

Returns a Caffeine cache loader that delegates to a Guava cache loader.

Parameters
loader:CacheLoader<K, V>

the cache loader used to obtain new values

Returns:CacheLoader<K, V>

a cache loader exposed under the Caffeine APIs

hasLoadAllback to summary
pack-priv static boolean hasLoadAll(CacheLoader<?, ?> cacheLoader)
hasMethodback to summary
pack-priv static boolean hasMethod(CacheLoader<?, ?> cacheLoader, String name, Class<?>... paramTypes)