Top Description Methods
org.hibernate.cache

public Interface OptimisticCache

extends Cache

Deprecated

as a consequence of Cache being deprecated. See corresponding docs for further information.

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.

Author
Steve Ebersole

Method Summary

Modifier and TypeMethod and Description
public void
setSource(OptimisticCacheSource
The source.
source
)

Indicates the "source" of the cached data.

public void
writeInsert(Object
The cache key.
key
,
Object
The data to be cached.
value
,
Object
The entity's version; or null if not versioned.
currentVersion
)

Called during CacheConcurrencyStrategy#insert processing for transactional strategies.

public void
writeLoad(Object
The cache key.
key
,
Object
The data to be cached.
value
,
Object
The entity's version; or null if not versioned.
currentVersion
)

Called during CacheConcurrencyStrategy#put processing for transactional strategies.

public void
writeUpdate(Object
The cache key.
key
,
Object
The data to be cached.
value
,
Object
The entity's current version
currentVersion
,
Object
The entity's previous version (before the update); or null if not versioned.
previousVersion
)

Called during CacheConcurrencyStrategy#update processing for transactional strategies.

Inherited from org.hibernate.cache.Cache:
cleardestroygetgetElementCountInMemorygetElementCountOnDiskgetRegionNamegetSizeInMemorygetTimeoutlocknextTimestampputreadremovetoMapunlockupdate

Method Detail

setSourceback to summary
public void setSource(OptimisticCacheSource source)

Indicates the "source" of the cached data. Currently this will only ever represent an org.hibernate.persister.entity.EntityPersister.

Made available to the cache so that it can access certain information about versioning strategy.

Parameters
source:OptimisticCacheSource

The source.

writeInsertback to summary
public void writeInsert(Object key, Object value, Object currentVersion)

Called during CacheConcurrencyStrategy#insert processing for transactional strategies. Indicates we have just performed an insert into the DB and now need to cache that entity's data.

Parameters
key:Object

The cache key.

value:Object

The data to be cached.

currentVersion:Object

The entity's version; or null if not versioned.

writeLoadback to summary
public void writeLoad(Object key, Object value, Object currentVersion)

Called during CacheConcurrencyStrategy#put processing for transactional strategies. Indicates we have just loaded an entity's state from the database and need it cached.

Parameters
key:Object

The cache key.

value:Object

The data to be cached.

currentVersion:Object

The entity's version; or null if not versioned.

writeUpdateback to summary
public void writeUpdate(Object key, Object value, Object currentVersion, Object previousVersion)

Called during CacheConcurrencyStrategy#update processing for transactional strategies. Indicates we have just performed an update against the DB and now need to cache the updated state.

Parameters
key:Object

The cache key.

value:Object

The data to be cached.

currentVersion:Object

The entity's current version

previousVersion:Object

The entity's previous version (before the update); or null if not versioned.