Class CacheUtils
java.lang.Object
org.aksw.commons.util.cache.CacheUtils
Utils for guava caches. Methods do not declare exceptions and the cache may be null.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <K,V> V static <K,V> V getIfPresent(com.google.common.cache.Cache<K, V> cache, K key) static voidinvalidateAll(com.google.common.cache.Cache<?, ?> cache) static <K,V> com.google.common.cache.CacheBuilder <K, V> recordStats(com.google.common.cache.CacheBuilder<K, V> builder, boolean onOrOff) Modify an existing builder to conditionally enable recording statsstatic com.google.common.cache.CacheStatsstats(com.google.common.cache.Cache<?, ?> cache)
-
Constructor Details
-
CacheUtils
public CacheUtils()
-
-
Method Details
-
invalidateAll
public static void invalidateAll(com.google.common.cache.Cache<?, ?> cache) -
getIfPresent
public static <K,V> V getIfPresent(com.google.common.cache.Cache<K, V> cache, K key) -
get
public static <K,V> V get(com.google.common.cache.Cache<K, V> cache, K key, Callable<? extends V> callable) -
stats
public static com.google.common.cache.CacheStats stats(com.google.common.cache.Cache<?, ?> cache) -
recordStats
public static <K,V> com.google.common.cache.CacheBuilder<K,V> recordStats(com.google.common.cache.CacheBuilder<K, V> builder, boolean onOrOff) Modify an existing builder to conditionally enable recording stats
-