Class CacheUtils

java.lang.Object
org.aksw.commons.util.cache.CacheUtils

public class CacheUtils extends Object
Utils for guava caches. Methods do not declare exceptions and the cache may be null.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <K, V> V
    get(com.google.common.cache.Cache<K,V> cache, K key, Callable<? extends V> callable)
     
    static <K, V> V
    getIfPresent(com.google.common.cache.Cache<K,V> cache, K key)
     
    static void
    invalidateAll(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 stats
    static com.google.common.cache.CacheStats
    stats(com.google.common.cache.Cache<?,?> cache)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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