Class InvalidationCacheAccessDelegate

java.lang.Object
org.infinispan.hibernate.cache.commons.access.InvalidationCacheAccessDelegate
All Implemented Interfaces:
AccessDelegate
Direct Known Subclasses:
NonTxInvalidationCacheAccessDelegate, TxInvalidationCacheAccessDelegate

public abstract class InvalidationCacheAccessDelegate extends Object implements AccessDelegate
Since:
3.5
Author:
Brian Stansberry, Galder ZamarreƱo
  • Field Details

  • Constructor Details

    • InvalidationCacheAccessDelegate

      protected InvalidationCacheAccessDelegate(InfinispanDataRegion region, PutFromLoadValidator validator)
      Create a new transactional access delegate instance.
      Parameters:
      region - to control access to
      validator - put from load validator
  • Method Details

    • get

      public Object get(Object session, Object key, long txTimestamp) throws org.hibernate.cache.CacheException
      Attempt to retrieve an object from the cache.
      Specified by:
      get in interface AccessDelegate
      Parameters:
      session -
      key - The key of the item to be retrieved
      txTimestamp - a timestamp prior to the transaction start time
      Returns:
      the cached object or null
      Throws:
      org.hibernate.cache.CacheException - if the cache retrieval failed
    • putFromLoad

      public boolean putFromLoad(Object session, Object key, Object value, long txTimestamp, Object version)
      Description copied from interface: AccessDelegate
      Attempt to cache an object, after loading from the database.
      Specified by:
      putFromLoad in interface AccessDelegate
      Parameters:
      session - Current session
      key - The item key
      value - The item
      txTimestamp - a timestamp prior to the transaction start time
      version - the item version number
      Returns:
      true if the object was successfully cached
    • putFromLoad

      public boolean putFromLoad(Object session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride) throws org.hibernate.cache.CacheException
      Attempt to cache an object, after loading from the database, explicitly specifying the minimalPut behavior.
      Specified by:
      putFromLoad in interface AccessDelegate
      Parameters:
      session - Current session
      key - The item key
      value - The item
      txTimestamp - a timestamp prior to the transaction start time
      version - the item version number
      minimalPutOverride - Explicit minimalPut flag
      Returns:
      true if the object was successfully cached
      Throws:
      org.hibernate.cache.CacheException - if storing the object failed
    • remove

      public void remove(Object session, Object key) throws org.hibernate.cache.CacheException
      Description copied from interface: AccessDelegate
      Called after an item has become stale (before the transaction completes).
      Specified by:
      remove in interface AccessDelegate
      Parameters:
      session - Current session
      key - The key of the item to remove
      Throws:
      org.hibernate.cache.CacheException - if removing the cached item fails
    • lockAll

      public void lockAll() throws org.hibernate.cache.CacheException
      Description copied from interface: AccessDelegate
      Called just before the delegate will have all entries removed. Any work to prevent concurrent modifications while this occurs should happen here
      Specified by:
      lockAll in interface AccessDelegate
      Throws:
      org.hibernate.cache.CacheException - if locking had an issue
    • unlockAll

      public void unlockAll() throws org.hibernate.cache.CacheException
      Description copied from interface: AccessDelegate
      Called just after the delegate had all entries removed via AccessDelegate.removeAll(). Any work required to allow for new modifications to happen should be done here
      Specified by:
      unlockAll in interface AccessDelegate
      Throws:
      org.hibernate.cache.CacheException - if unlocking had an issue
    • removeAll

      public void removeAll() throws org.hibernate.cache.CacheException
      Description copied from interface: AccessDelegate
      Called to evict data from the entire region
      Specified by:
      removeAll in interface AccessDelegate
      Throws:
      org.hibernate.cache.CacheException - if eviction the region fails
    • evict

      public void evict(Object key) throws org.hibernate.cache.CacheException
      Description copied from interface: AccessDelegate
      Forcibly evict an item from the cache immediately without regard for transaction isolation.
      Specified by:
      evict in interface AccessDelegate
      Parameters:
      key - The key of the item to remove
      Throws:
      org.hibernate.cache.CacheException - if evicting the item fails
    • evictAll

      public void evictAll() throws org.hibernate.cache.CacheException
      Description copied from interface: AccessDelegate
      Forcibly evict all items from the cache immediately without regard for transaction isolation.
      Specified by:
      evictAll in interface AccessDelegate
      Throws:
      org.hibernate.cache.CacheException - if evicting items fails
    • unlockItem

      public void unlockItem(Object session, Object key) throws org.hibernate.cache.CacheException
      Description copied from interface: AccessDelegate
      Called when we have finished the attempted update/delete (which may or may not have been successful), after transaction completion. This method is used by "asynchronous" concurrency strategies.
      Specified by:
      unlockItem in interface AccessDelegate
      key - The item key
      Throws:
      org.hibernate.cache.CacheException - Propogated from underlying Region