Interface MutableEntry<K,V>
- Type Parameters:
K- the type of keyV- the type of value
- All Superinterfaces:
Cache.Entry<K,V>
A mutable representation of a
Cache.Entry.
Mutable entries are used by EntryProcessors to mutate
Cache.Entrys in place, atomically.
- Since:
- 1.0
- See Also:
-
Method Summary
Methods inherited from interface Cache.Entry
getKey, unwrap
-
Method Details
-
exists
boolean exists()Checks for the existence of the entry in the cache- Returns:
- true if the entry exists
-
remove
void remove()Removes the entry from the Cache.This has the same semantics as calling
Cache.remove(K). -
getValue
V getValue()Returns the value stored in the cache.If the cache is configured to use read-through, and this method would return null because the entry is missing from the cache, the Cache's
CacheLoaderis called in an attempt to load the entry.- Specified by:
getValuein interfaceCache.Entry<K,V> - Returns:
- the value corresponding to this entry
-
setValue
Sets or replaces the value associated with the key.If
exists()is false and setValue is called then a mapping is added to the cache visible once the EntryProcessor completes. Moreover a second invocation ofexists()will return true.- Parameters:
value- the value to update the entry with- Throws:
ClassCastException- if the implementation supports and is configured to perform runtime-type-checking, and value type is incompatible with that which has been configured for theCache
-