public interface Cache<K,V>
Modifier and Type | Interface and Description |
---|---|
static interface |
Cache.CacheFilter<V>
CacheFileter is used to select values to remove during a removeAll
invocation.
|
static interface |
Cache.CacheListener<V>
Callback listener for cache events.
|
Modifier and Type | Method and Description |
---|---|
void |
add(K key,
V value)
Add a new entry to the cache.
|
void |
checkIn(K key)
Marks the entry available, so it can be accessed again.
|
V |
checkOut(K key)
Marks the entry checked-out, so this entry can not be accessed until
checked-in.
|
Cache.CacheListener<V> |
getListener()
Gets the listener for cache events.
|
V |
remove(K key)
Removes the entry from the cache.
|
void |
removeAll(Cache.CacheFilter<V> filter)
Removes all of th entries that match the specified filter.
|
void |
setListener(Cache.CacheListener<V> listener)
Sets the listener for cache events.
|
Cache.CacheListener<V> getListener()
void setListener(Cache.CacheListener<V> listener)
void add(K key, V value)
V checkOut(K key) throws java.lang.Exception
java.lang.IllegalStateException
- if the entry is already checked out.java.lang.Exception
- if an entry is loaded and the afterLoad method threw an
exceptionvoid checkIn(K key)
java.lang.IllegalStateException
- if the entry is not checked out.void removeAll(Cache.CacheFilter<V> filter)