Package io.trino.plugin.base.cache
Class EvictableCache<K,V>
- java.lang.Object
-
- com.google.common.cache.AbstractCache<K,V>
-
- io.trino.plugin.base.cache.EvictableCache<K,V>
-
- All Implemented Interfaces:
com.google.common.cache.Cache<K,V>
public class EvictableCache<K,V> extends com.google.common.cache.AbstractCache<K,V> implements com.google.common.cache.Cache<K,V>ACacheimplementation similar to ones produced byCacheBuilder.build(), but one that does not exhibit Guava issue #1881: a cache inspection withgetIfPresent(Object)orget(Object, Callable)is guaranteed to return fresh state afterinvalidate(Object),invalidateAll(Iterable)orinvalidateAll()were called.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ConcurrentMap<K,V>asMap()static <K,V>
EvictableCache<K,V>buildWith(com.google.common.cache.CacheBuilder<? super K,Object> cacheBuilder)voidcleanUp()Vget(K key, Callable<? extends V> loader)VgetIfPresent(Object key)voidinvalidate(Object key)voidinvalidateAll()voidinvalidateAll(Iterable<?> keys)voidput(K key, V value)longsize()com.google.common.cache.CacheStatsstats()
-
-
-
Method Detail
-
buildWith
public static <K,V> EvictableCache<K,V> buildWith(com.google.common.cache.CacheBuilder<? super K,Object> cacheBuilder)
-
get
public V get(K key, Callable<? extends V> loader) throws ExecutionException
- Specified by:
getin interfacecom.google.common.cache.Cache<K,V>- Overrides:
getin classcom.google.common.cache.AbstractCache<K,V>- Throws:
ExecutionException
-
invalidate
public void invalidate(Object key)
-
invalidateAll
public void invalidateAll(Iterable<?> keys)
-
invalidateAll
public void invalidateAll()
-
size
public long size()
-
stats
public com.google.common.cache.CacheStats stats()
-
asMap
public ConcurrentMap<K,V> asMap()
-
-