Package org.apache.jena.atlas.lib
Interface Cache<Key,Value>
-
- All Known Implementing Classes:
Cache0,Cache1,CacheGuava,CacheSimple,CacheWrapper
public interface Cache<Key,Value>A cache
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()booleancontainsKey(Key key)Does the cache contain the key?ValuegetIfPresent(Key key)Get from cache - or return null.ValuegetOrFill(Key key, java.util.concurrent.Callable<Value> callable)Get from cache, of not present, call theCallableto try to fill the cache.booleanisEmpty()java.util.Iterator<Key>keys()Iterate over all keys.voidput(Key key, Value thing)Insert into the cachevoidremove(Key key)Remove from cache - return true if key referenced an entryvoidsetDropHandler(java.util.function.BiConsumer<Key,Value> dropHandler)Register a callback - called when an object is dropped from the cache (optional operation)longsize()Current size of cache
-
-
-
Method Detail
-
containsKey
boolean containsKey(Key key)
Does the cache contain the key?
-
getOrFill
Value getOrFill(Key key, java.util.concurrent.Callable<Value> callable)
Get from cache, of not present, call theCallableto try to fill the cache. This operation should be atomic.
-
remove
void remove(Key key)
Remove from cache - return true if key referenced an entry
-
keys
java.util.Iterator<Key> keys()
Iterate over all keys. Iterating over the keys requires the caller be thread-safe.
-
isEmpty
boolean isEmpty()
-
clear
void clear()
-
size
long size()
Current size of cache
-
-