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 Summary
Fields Modifier and Type Field Description protected org.infinispan.AdvancedCache
cache
protected static InfinispanMessageLogger
log
protected PutFromLoadValidator
putValidator
protected InfinispanDataRegion
region
protected static boolean
trace
protected org.infinispan.AdvancedCache<Object,Object>
writeCache
-
Constructor Summary
Constructors Modifier Constructor Description protected
InvalidationCacheAccessDelegate(InfinispanDataRegion region, PutFromLoadValidator validator)
Create a new transactional access delegate instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
evict(Object key)
Forcibly evict an item from the cache immediately without regard for transaction isolation.void
evictAll()
Forcibly evict all items from the cache immediately without regard for transaction isolation.Object
get(Object session, Object key, long txTimestamp)
Attempt to retrieve an object from the cache.boolean
putFromLoad(Object session, Object key, Object value, long txTimestamp, Object version)
Attempt to cache an object, after loading from the database.boolean
putFromLoad(Object session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
Attempt to cache an object, after loading from the database, explicitly specifying the minimalPut behavior.void
remove(Object session, Object key)
Called after an item has become stale (before the transaction completes).void
removeAll()
Called to evict data from the entire regionvoid
unlockItem(Object session, Object key)
Called when we have finished the attempted update/delete (which may or may not have been successful), after transaction completion.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.infinispan.hibernate.cache.commons.access.AccessDelegate
afterInsert, afterUpdate, insert, update
-
-
-
-
Field Detail
-
log
protected static final InfinispanMessageLogger log
-
trace
protected static final boolean trace
-
cache
protected final org.infinispan.AdvancedCache cache
-
region
protected final InfinispanDataRegion region
-
putValidator
protected final PutFromLoadValidator putValidator
-
-
Constructor Detail
-
InvalidationCacheAccessDelegate
protected InvalidationCacheAccessDelegate(InfinispanDataRegion region, PutFromLoadValidator validator)
Create a new transactional access delegate instance.- Parameters:
region
- to control access tovalidator
- put from load validator
-
-
Method Detail
-
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 interfaceAccessDelegate
- Parameters:
session
-key
- The key of the item to be retrievedtxTimestamp
- 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 interfaceAccessDelegate
- Parameters:
session
- Current sessionkey
- The item keyvalue
- The itemtxTimestamp
- a timestamp prior to the transaction start timeversion
- 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 interfaceAccessDelegate
- Parameters:
session
- Current sessionkey
- The item keyvalue
- The itemtxTimestamp
- a timestamp prior to the transaction start timeversion
- the item version numberminimalPutOverride
- 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 interfaceAccessDelegate
- Parameters:
session
- Current sessionkey
- The key of the item to remove- Throws:
org.hibernate.cache.CacheException
- if removing the cached item fails
-
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 interfaceAccessDelegate
- 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 interfaceAccessDelegate
- 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 interfaceAccessDelegate
- 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 interfaceAccessDelegate
key
- The item key- Throws:
org.hibernate.cache.CacheException
- Propogated from underlyingRegion
-
-