Interface MutableEntry<K,V>

Type Parameters:
K - the type of key
V - the type of value
All Superinterfaces:
Cache.Entry<K,V>

public interface MutableEntry<K,V> extends 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

    Modifier and Type
    Method
    Description
    boolean
    Checks for the existence of the entry in the cache
    Returns the value stored in the cache.
    void
    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 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 CacheLoader is called in an attempt to load the entry.

      Specified by:
      getValue in interface Cache.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 of exists() 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 the Cache