org.hibernate.cache.spi.access
Interface EntityRegionAccessStrategy

All Superinterfaces:
RegionAccessStrategy
All Known Implementing Classes:
NonstopAwareEntityRegionAccessStrategy, NonStrictReadWriteEhcacheEntityRegionAccessStrategy, ReadOnlyEhcacheEntityRegionAccessStrategy, ReadWriteEhcacheEntityRegionAccessStrategy, TransactionalEhcacheEntityRegionAccessStrategy

public interface EntityRegionAccessStrategy
extends RegionAccessStrategy

Contract for managing transactional and concurrent access to cached entity data. The expected call sequences related to various operations are:

There is another usage pattern that is used to invalidate entries after performing "bulk" HQL/SQL operations: RegionAccessStrategy.lockRegion() -> RegionAccessStrategy.removeAll() -> RegionAccessStrategy.unlockRegion(org.hibernate.cache.spi.access.SoftLock)


Method Summary
 boolean afterInsert(Object key, Object value, Object version)
          Called after an item has been inserted (after the transaction completes), instead of calling release().
 boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock)
          Called after an item has been updated (after the transaction completes), instead of calling release().
 EntityRegion getRegion()
          Get the wrapped entity cache region
 boolean insert(Object key, Object value, Object version)
          Called after an item has been inserted (before the transaction completes), instead of calling evict().
 boolean update(Object key, Object value, Object currentVersion, Object previousVersion)
          Called after an item has been updated (before the transaction completes), instead of calling evict().
 
Methods inherited from interface org.hibernate.cache.spi.access.RegionAccessStrategy
evict, evictAll, get, lockItem, lockRegion, putFromLoad, putFromLoad, remove, removeAll, unlockItem, unlockRegion
 

Method Detail

getRegion

EntityRegion getRegion()
Get the wrapped entity cache region

Returns:
The underlying region

insert

boolean insert(Object key,
               Object value,
               Object version)
               throws CacheException
Called after an item has been inserted (before the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.

Parameters:
key - The item key
value - The item
version - The item's version value
Returns:
Were the contents of the cache actual changed by this operation?
Throws:
CacheException - Propogated from underlying Region

afterInsert

boolean afterInsert(Object key,
                    Object value,
                    Object version)
                    throws CacheException
Called after an item has been inserted (after the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.

Parameters:
key - The item key
value - The item
version - The item's version value
Returns:
Were the contents of the cache actual changed by this operation?
Throws:
CacheException - Propogated from underlying Region

update

boolean update(Object key,
               Object value,
               Object currentVersion,
               Object previousVersion)
               throws CacheException
Called after an item has been updated (before the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.

Parameters:
key - The item key
value - The item
currentVersion - The item's current version value
previousVersion - The item's previous version value
Returns:
Were the contents of the cache actual changed by this operation?
Throws:
CacheException - Propogated from underlying Region

afterUpdate

boolean afterUpdate(Object key,
                    Object value,
                    Object currentVersion,
                    Object previousVersion,
                    SoftLock lock)
                    throws CacheException
Called after an item has been updated (after the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.

Parameters:
key - The item key
value - The item
currentVersion - The item's current version value
previousVersion - The item's previous version value
lock - The lock previously obtained from RegionAccessStrategy.lockItem(java.lang.Object, java.lang.Object)
Returns:
Were the contents of the cache actual changed by this operation?
Throws:
CacheException - Propogated from underlying Region


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.