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
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Key key) Does the cache contain the key?getIfPresent(Key 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<Key, Value> dropHandler) Register a callback - called when an object is dropped from the cache (optional operation)longsize()Current size of cache
-
Method Details
-
containsKey
Does the cache contain the key? -
getIfPresent
Get from cache - or return null. -
getOrFill
Get from cache, of not present, call theCallableto try to fill the cache. This operation should be atomic. -
put
Insert into the cache -
remove
Remove from cache - return true if key referenced an entry -
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 -
setDropHandler
Register a callback - called when an object is dropped from the cache (optional operation)
-