Package org.apache.jena.atlas.lib.cache
Class CacheGuava<K,V>
- java.lang.Object
-
- org.apache.jena.atlas.lib.cache.CacheGuava<K,V>
-
-
Constructor Summary
Constructors Constructor Description CacheGuava(int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsKey(K key)Does the cache contain the key?VgetIfPresent(K key)Get from cache - or return null.VgetOrFill(K key, java.util.concurrent.Callable<V> filler)Get from cache, of not present, call theCallableto try to fill the cache.booleanisEmpty()java.util.Iterator<K>keys()Iterate over all keys.voidput(K key, V thing)Insert into the cachevoidremove(K key)Remove from cache - return true if key referenced an entryvoidsetDropHandler(java.util.function.BiConsumer<K,V> dropHandler)Register a callback - called when an object is dropped from the cache (optional operation)longsize()Current size of cacheorg.apache.jena.ext.com.google.common.cache.CacheStatsstats()
-
-
-
Method Detail
-
getOrFill
public V getOrFill(K key, java.util.concurrent.Callable<V> filler)
Description copied from interface:CacheGet from cache, of not present, call theCallableto try to fill the cache. This operation should be atomic.
-
getIfPresent
public V getIfPresent(K key)
Description copied from interface:CacheGet from cache - or return null.- Specified by:
getIfPresentin interfaceCache<K,V>
-
containsKey
public boolean containsKey(K key)
Description copied from interface:CacheDoes the cache contain the key?- Specified by:
containsKeyin interfaceCache<K,V>
-
remove
public void remove(K key)
Description copied from interface:CacheRemove from cache - return true if key referenced an entry
-
keys
public java.util.Iterator<K> keys()
Description copied from interface:CacheIterate over all keys. Iterating over the keys requires the caller be thread-safe.
-
size
public long size()
Description copied from interface:CacheCurrent size of cache
-
setDropHandler
public void setDropHandler(java.util.function.BiConsumer<K,V> dropHandler)
Description copied from interface:CacheRegister a callback - called when an object is dropped from the cache (optional operation)- Specified by:
setDropHandlerin interfaceCache<K,V>
-
stats
public org.apache.jena.ext.com.google.common.cache.CacheStats stats()
-
-