| Constructor and Description |
|---|
CacheWrapper(Cache<Key,T> cache) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
containsKey(Key key)
Does the cache contain the key?
|
T |
getIfPresent(Key key)
Get from cache - or return null.
|
T |
getOrFill(Key key,
Callable<T> 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,
T thing)
Insert into the cache
|
void |
remove(Key key)
Remove from cache - return true if key referenced an entry
|
void |
setDropHandler(BiConsumer<Key,T> dropHandler)
Register a callback - called when an object is dropped from the cache (optional operation)
|
long |
size()
Current size of cache
|
public boolean containsKey(Key key)
CachecontainsKey in interface Cache<Key,T>public T getIfPresent(Key key)
CachegetIfPresent in interface Cache<Key,T>public T getOrFill(Key key, Callable<T> callable)
CacheCallable
to try to fill the cache. This operation should be atomic.public Iterator<Key> keys()
Cachepublic void put(Key key, T thing)
Cachepublic void remove(Key key)
Cachepublic void setDropHandler(BiConsumer<Key,T> dropHandler)
CachesetDropHandler in interface Cache<Key,T>Licenced under the Apache License, Version 2.0