public interface Cache<Key,Value>
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
containsKey(Key key)
Does the cache contain the key?
|
Value |
getIfPresent(Key key)
Get from cache - or return null.
|
Value |
getOrFill(Key key,
Callable<Value> callable)
Get from cache, of not present, call the
Callable
to try to fill the cache. |
boolean |
isEmpty() |
Iterator<Key> |
keys()
Iterate over all keys.
|
void |
put(Key key,
Value thing)
Insert into the cache
|
void |
remove(Key key)
Remove from cache - return true if key referenced an entry
|
void |
setDropHandler(BiConsumer<Key,Value> dropHandler)
Register a callback - called when an object is dropped from the cache (optional operation)
|
long |
size()
Current size of cache
|
boolean containsKey(Key key)
Value getOrFill(Key key, Callable<Value> callable)
Callable
to try to fill the cache. This operation should be atomic.void remove(Key key)
Iterator<Key> keys()
boolean isEmpty()
void clear()
long size()
void setDropHandler(BiConsumer<Key,Value> dropHandler)
Licenced under the Apache License, Version 2.0