| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
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 theCache 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.
| Method Summary | |
|---|---|
|  void | setSource(OptimisticCacheSource source)Indicates the "source" of the cached data. | 
|  void | writeInsert(Object key,
            Object value,
            Object currentVersion)Called during CacheConcurrencyStrategy.insert(java.lang.Object, java.lang.Object, java.lang.Object)processing for
 transactional strategies. | 
|  void | writeLoad(Object key,
          Object value,
          Object currentVersion)Called during CacheConcurrencyStrategy.put(java.lang.Object, java.lang.Object, long, java.lang.Object, java.util.Comparator, boolean)processing for
 transactional strategies. | 
|  void | writeUpdate(Object key,
            Object value,
            Object currentVersion,
            Object previousVersion)Called during CacheConcurrencyStrategy.update(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object)processing for
 transactional strategies. | 
| Methods inherited from interface org.hibernate.cache.Cache | 
|---|
| clear, destroy, get, getElementCountInMemory, getElementCountOnDisk, getRegionName, getSizeInMemory, getTimeout, lock, nextTimestamp, put, read, remove, toMap, unlock, update | 
| Method Detail | 
|---|
void setSource(OptimisticCacheSource source)
EntityPersister.
 
 Made available to the cache so that it can access certain information
 about versioning strategy.
source - The source.
void writeInsert(Object key,
                 Object value,
                 Object currentVersion)
CacheConcurrencyStrategy.insert(java.lang.Object, java.lang.Object, java.lang.Object) processing for
 transactional strategies.  Indicates we have just performed an insert
 into the DB and now need to cache that entity's data.
key - The cache key.value - The data to be cached.currentVersion - The entity's version; or null if not versioned.
void writeUpdate(Object key,
                 Object value,
                 Object currentVersion,
                 Object previousVersion)
CacheConcurrencyStrategy.update(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object) processing for
 transactional strategies.  Indicates we have just performed an update
 against the DB and now need to cache the updated state.
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.
void writeLoad(Object key,
               Object value,
               Object currentVersion)
CacheConcurrencyStrategy.put(java.lang.Object, java.lang.Object, long, java.lang.Object, java.util.Comparator, boolean) processing for
 transactional strategies.  Indicates we have just loaded an entity's
 state from the database and need it cached.
key - The cache key.value - The data to be cached.currentVersion - The entity's version; or null if not versioned.| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||