Interface LockingCache<K extends Serializable,V>

All Superinterfaces:
SimpleCache<K,V>

public interface LockingCache<K extends Serializable,V> extends SimpleCache<K,V>
Interface for caches that support value locking
Since:
4.1.6
Author:
Derek Hulley
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Determine if a value (addition, removal or update) has been locked for the remainer of the transaction
    void
    lockValue(K key)
    Prevent a key's value from being changed for the duriation of the transaction.
    void
    Cancel any previous lock applied to a key's value.

    Methods inherited from interface org.alfresco.repo.cache.SimpleCache

    clear, contains, get, getKeys, put, remove
  • Method Details

    • isValueLocked

      boolean isValueLocked(K key)
      Determine if a value (addition, removal or update) has been locked for the remainer of the transaction
      Parameters:
      key - the cache key to check up on
      Returns:
      true if the value will not change for the remaineder of the transaction
    • lockValue

      void lockValue(K key)
      Prevent a key's value from being changed for the duriation of the transaction. By default, further attempts to modify the associated value will be ignored; this includes add a value back after removal.
      Parameters:
      key - the cache key that will be locked against change
    • unlockValue

      void unlockValue(K key)
      Cancel any previous lock applied to a key's value.
      Parameters:
      key - the cache key that will be unlocked, allowing changes