org.hibernate.cache.CacheConcurrencyStrategy |
![]() |
This interface is deprecated.
As of 3.3; see for details.
Implementors manage transactional access to cached data. Transactions pass in a timestamp indicating transaction start time. Two different implementation patterns are provided for.
lock(Object, Object)
-> evict(Object)
-> release(Object, SoftLock)
lock(Object, Object)
-> update(Object, Object, Object, Object)
-> afterUpdate(Object, Object, Object, SoftLock)
insert(Object, Object, Object)
-> afterInsert(Object, Object, Object)
lock(Object, Object)
-> evict(Object)
-> release(Object, SoftLock)
Note that, for an asynchronous cache, cache invalidation must be a two
step process (lock->release, or lock-afterUpdate), since this is the only
way to guarantee consistency with the database for a nontransactional cache
implementation. For a synchronous cache, cache invalidation is a single
step process (evict, or update). Hence, this interface defines a three
step process, to cater for both models.
Note that query result caching does not go through a concurrency strategy; they
are managed directly against the underlying cache regions
.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Called after an item has been inserted (after the transaction completes),
instead of calling release().
| |||||||||||
Called after an item has been updated (after the transaction completes),
instead of calling release().
| |||||||||||
Evict all items from the cache immediately.
| |||||||||||
Clean up all resources.
| |||||||||||
Called after an item has become stale (before the transaction completes).
| |||||||||||
Attempt to retrieve an object from the cache.
| |||||||||||
Get the wrapped cache implementation
| |||||||||||
Get the cache region name
| |||||||||||
Called after an item has been inserted (before the transaction completes),
instead of calling evict().
| |||||||||||
We are going to attempt to update/delete the keyed object.
| |||||||||||
Attempt to cache an object, after loading from the database.
| |||||||||||
Called when we have finished the attempted update/delete (which may or
may not have been successful), after transaction completion.
| |||||||||||
Evict an item from the cache immediately (without regard for transaction
isolation).
| |||||||||||
Set the underlying cache implementation.
| |||||||||||
Called after an item has been updated (before the transaction completes),
instead of calling evict().
|
Called after an item has been inserted (after the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.
CacheException |
---|
Called after an item has been updated (after the transaction completes), instead of calling release(). This method is used by "asynchronous" concurrency strategies.
CacheException |
---|
Clean up all resources.
Called after an item has become stale (before the transaction completes). This method is used by "synchronous" concurrency strategies.
CacheException |
---|
Attempt to retrieve an object from the cache. Mainly used in attempting to resolve entities/collections from the second level cache.
txTimestamp | a timestamp prior to the transaction start time |
---|
CacheException |
---|
Called after an item has been inserted (before the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.
CacheException |
---|
We are going to attempt to update/delete the keyed object. This method is used by "asynchronous" concurrency strategies.
The returned object must be passed back to release(), to release the lock. Concurrency strategies which do not support client-visible locks may silently return null.CacheException |
---|
Attempt to cache an object, after loading from the database.
txTimestamp | a timestamp prior to the transaction start time |
---|---|
version | the item version number |
versionComparator | a comparator used to compare version numbers |
minimalPut | indicates that the cache should avoid a put is the item is already cached |
CacheException |
---|
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.
CacheException |
---|
Evict an item from the cache immediately (without regard for transaction isolation).
CacheException |
---|
Called after an item has been updated (before the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.
CacheException |
---|