Package org.apache.jena.atlas.lib.cache
Class CacheGuava<K,V>
java.lang.Object
org.apache.jena.atlas.lib.cache.CacheGuava<K,V>
- All Implemented Interfaces:
Cache<K,V>
Wrapper around a shaded com.google.common.cache
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(K key) Does the cache contain the key?getIfPresent(K key) Get from cache - or return null.Get from cache, of not present, call theCallableto try to fill the cache.booleanisEmpty()keys()Iterate over all keys.voidInsert into the cachevoidRemove from cache - return true if key referenced an entryvoidsetDropHandler(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()
-
Constructor Details
-
CacheGuava
public CacheGuava(int size)
-
-
Method Details
-
getOrFill
Description copied from interface:CacheGet from cache, of not present, call theCallableto try to fill the cache. This operation should be atomic. -
getIfPresent
Description copied from interface:CacheGet from cache - or return null.- Specified by:
getIfPresentin interfaceCache<K,V>
-
put
Description copied from interface:CacheInsert into the cache -
containsKey
Description copied from interface:CacheDoes the cache contain the key?- Specified by:
containsKeyin interfaceCache<K,V>
-
remove
Description copied from interface:CacheRemove from cache - return true if key referenced an entry -
keys
Description copied from interface:CacheIterate over all keys. Iterating over the keys requires the caller be thread-safe. -
isEmpty
public boolean isEmpty() -
clear
public void clear() -
size
public long size()Description copied from interface:CacheCurrent size of cache -
setDropHandler
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()
-