org.hibernate.cache
Interface OptimisticCache
- Cache
public interface OptimisticCache
A contract for transactional cache implementations which support
optimistic locking of items within the cache.
The optimisitic locking capabilities are only utilized for
the entity cache regions.
Unlike the methods on the
Cache
interface, all the methods
here will only ever be called from access scenarios where versioned
data is actually a possiblity (i.e., entity data). Be sure to consult
with
OptimisticCacheSource.isVersioned()
to determine whether
versioning is actually in effect.
void | setSource(OptimisticCacheSource source) - Indicates the "source" of the cached data.
|
void | writeInsert(Object key, Object value, Object currentVersion) - Called during
CacheConcurrencyStrategy.insert(Object,Object,Object) processing for
transactional strategies.
|
void | writeLoad(Object key, Object value, Object currentVersion) - Called during
CacheConcurrencyStrategy.put(Object,Object,long,Object,Comparator,boolean) processing for
transactional strategies.
|
void | writeUpdate(Object key, Object value, Object currentVersion, Object previousVersion) - Called during
CacheConcurrencyStrategy.update(Object,Object,Object,Object) processing for
transactional strategies.
|
clear , destroy , get , getElementCountInMemory , getElementCountOnDisk , getRegionName , getSizeInMemory , getTimeout , lock , nextTimestamp , put , read , remove , toMap , unlock , update |
setSource
public void setSource(OptimisticCacheSource source)
Indicates the "source" of the cached data. Currently this will
only ever represent an
EntityPersister
.
Made available to the cache so that it can access certain information
about versioning strategy.
writeInsert
public void writeInsert(Object key,
Object value,
Object currentVersion)
key
- The cache key.value
- The data to be cached.currentVersion
- The entity's version; or null if not versioned.
writeLoad
public void writeLoad(Object key,
Object value,
Object currentVersion)
key
- The cache key.value
- The data to be cached.currentVersion
- The entity's version; or null if not versioned.
writeUpdate
public void writeUpdate(Object key,
Object value,
Object currentVersion,
Object previousVersion)
key
- The cache key.value
- The data to be cached.currentVersion
- The entity's current versionpreviousVersion
- The entity's previous version (before the update);
or null if not versioned.