Package javax.cache.processor
Interface MutableEntry<K,V>
-
- Type Parameters:
K
- the type of keyV
- the type of value
- All Superinterfaces:
Cache.Entry<K,V>
public interface MutableEntry<K,V> extends Cache.Entry<K,V>
A mutable representation of aCache.Entry
.Mutable entries are used by
EntryProcessor
s to mutateCache.Entry
s in place, atomically.- Since:
- 1.0
- See Also:
EntryProcessor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
exists()
Checks for the existence of the entry in the cacheV
getValue()
Returns the value stored in the cache.void
remove()
Removes the entry from the Cache.void
setValue(V value)
Sets or replaces the value associated with the key.-
Methods inherited from interface javax.cache.Cache.Entry
getKey, unwrap
-
-
-
-
Method Detail
-
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
CacheLoader
is called in an attempt to load the entry.- Specified by:
getValue
in interfaceCache.Entry<K,V>
- Returns:
- the value corresponding to this entry
-
setValue
void setValue(V value)
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:
java.lang.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
-
-