Package io.trino.plugin.base.cache
Class EvictableLoadingCache<K,V>
- java.lang.Object
-
- com.google.common.cache.AbstractCache<K,V>
-
- com.google.common.cache.AbstractLoadingCache<K,V>
-
- io.trino.plugin.base.cache.EvictableLoadingCache<K,V>
-
- All Implemented Interfaces:
com.google.common.base.Function<K,V>,com.google.common.cache.Cache<K,V>,com.google.common.cache.LoadingCache<K,V>,Function<K,V>
public class EvictableLoadingCache<K,V> extends com.google.common.cache.AbstractLoadingCache<K,V>ALoadingCacheimplementation similar to ones produced byCacheBuilder.build(CacheLoader), but one that does not exhibit Guava issue #1881: a cache inspection withgetIfPresent(Object)orget(Object)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>
com.google.common.cache.LoadingCache<K,V>build(OptionalLong expiresAfterWriteMillis, OptionalLong refreshMillis, long maximumSize, boolean recordStats, com.google.common.cache.CacheLoader<K,V> cacheLoader)voidcleanUp()Vget(K key)com.google.common.collect.ImmutableMap<K,V>getAll(Iterable<? extends K> keys)VgetIfPresent(Object key)voidinvalidate(Object key)voidinvalidateAll()voidinvalidateAll(Iterable<?> keys)longsize()com.google.common.cache.CacheStatsstats()-
Methods inherited from class com.google.common.cache.AbstractLoadingCache
apply, getUnchecked, refresh
-
-
-
-
Method Detail
-
build
public static <K,V> com.google.common.cache.LoadingCache<K,V> build(OptionalLong expiresAfterWriteMillis, OptionalLong refreshMillis, long maximumSize, boolean recordStats, com.google.common.cache.CacheLoader<K,V> cacheLoader)
-
get
public V get(K key) throws ExecutionException
- Throws:
ExecutionException
-
getAll
public com.google.common.collect.ImmutableMap<K,V> getAll(Iterable<? extends K> keys) throws ExecutionException
- Specified by:
getAllin interfacecom.google.common.cache.LoadingCache<K,V>- Overrides:
getAllin classcom.google.common.cache.AbstractLoadingCache<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()
-
-