Class CaffeinatedGuava
- java.lang.Object
-
- com.github.benmanes.caffeine.guava.CaffeinatedGuava
-
public final class CaffeinatedGuava extends Object
Static utility methods pertaining to adapting between Caffeine and Guava cache interfaces.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K,V,K1 extends K,V1 extends V>
Cache<K1,V1>build(Caffeine<K,V> builder)
Returns a Caffeine cache wrapped in a GuavaCache
facade.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 GuavaLoadingCache
facade.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 GuavaLoadingCache
facade.static <K,V>
CacheLoader<K,V>caffeinate(CacheLoader<K,V> loader)
Returns a Caffeine cache loader that delegates to a Guava cache loader.
-
-
-
Method Detail
-
build
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 GuavaCache
facade.- 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 GuavaLoadingCache
facade.- 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 GuavaLoadingCache
facade.- Parameters:
builder
- the configured cache builderloader
- the cache loader used to obtain new values- Returns:
- a cache exposed under the Guava APIs
-
caffeinate
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
- the cache loader used to obtain new values- Returns:
- a cache loader exposed under the Caffeine APIs
-
-