Class CaffeinatedGuava
java.lang.Object
com.github.benmanes.caffeine.guava.CaffeinatedGuava
Static utility methods pertaining to adapting between Caffeine and Guava cache interfaces.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K, V, K1 extends K, V1 extends V>
Cache<K1, V1> Returns a Caffeine cache wrapped in a GuavaCachefacade.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 GuavaLoadingCachefacade.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 GuavaLoadingCachefacade.static <K,V> CacheLoader <K, V> caffeinate(CacheLoader<K, V> loader) Returns a Caffeine cache loader that delegates to a Guava cache loader.
-
Method Details
-
build
Returns a Caffeine cache wrapped in a GuavaCachefacade.- Type Parameters:
K- the most general key type to create caches forV- the most general value type to create caches forK1- the key type of the cacheV1- the value type of the cache- Parameters:
builder- the configured cache builder- Returns:
- a cache exposed under the Guava APIs
-
build
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 GuavaLoadingCachefacade.- Type Parameters:
K- the most general key type to create caches forV- the most general value type to create caches forK1- the key type of the cacheV1- the value type of the cache- Parameters:
builder- the configured cache builderloader- the cache loader used to obtain new values- Returns:
- a cache exposed under the Guava APIs
-
build
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 GuavaLoadingCachefacade.- Type Parameters:
K- the most general key type to create caches forV- the most general value type to create caches forK1- the key type of the cacheV1- the value type of the cache- Parameters:
builder- the configured cache builderloader- the cache loader used to obtain new values- Returns:
- a cache exposed under the Guava APIs
-
caffeinate
Returns a Caffeine cache loader that delegates to a Guava cache loader.- Type Parameters:
K- the type of keysV- the type of values- Parameters:
loader- the cache loader used to obtain new values- Returns:
- a cache loader exposed under the Caffeine APIs
-