org.hibernate.cache.spi.access
Interface NaturalIdRegionAccessStrategy

All Superinterfaces:
RegionAccessStrategy
All Known Implementing Classes:
NonstopAwareNaturalIdRegionAccessStrategy, NonStrictReadWriteEhcacheNaturalIdRegionAccessStrategy, ReadOnlyEhcacheNaturalIdRegionAccessStrategy, ReadWriteEhcacheNaturalIdRegionAccessStrategy, TransactionalEhcacheNaturalIdRegionAccessStrategy

public interface NaturalIdRegionAccessStrategy
extends RegionAccessStrategy

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

Note the special case of UPDATES above. Because the cache key itself has changed here we need to remove the old entry as well as

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)

IMPORTANT : NaturalIds are not versioned so null will always be passed to the version parameter to:


Method Summary
 boolean afterInsert(Object key, Object value)
          Called after an item has been inserted (after the transaction completes), instead of calling release().
 boolean afterUpdate(Object key, Object value, SoftLock lock)
          Called after an item has been updated (after the transaction completes), instead of calling release().
 NaturalIdRegion getRegion()
          Get the wrapped naturalId cache region
 boolean insert(Object key, Object value)
          Called after an item has been inserted (before the transaction completes), instead of calling evict().
 boolean update(Object key, Object value)
          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

NaturalIdRegion getRegion()
Get the wrapped naturalId cache region

Returns:
The underlying region

insert

boolean insert(Object key,
               Object value)
               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
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)
                    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
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)
               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
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,
                    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
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-2013 Red Hat, Inc. All Rights Reserved.