Top Description Fields Constructors Methods
org.hibernate.cache

public Class TransactionalCache

extends Object
implements CacheConcurrencyStrategy
Class Inheritance
All Implemented Interfaces
org.hibernate.cache.CacheConcurrencyStrategy
Imports
java.util.Comparator, org.slf4j.Logger, .LoggerFactory, org.hibernate.cache.access.SoftLock

Deprecated

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

Support for fully transactional cache implementations like JBoss TreeCache. Note that this might be a less scalable concurrency strategy than ReadWriteCache. This is a "synchronous" concurrency strategy.
Author
Gavin King

Field Summary

Modifier and TypeField and Description
private Cache
cache

Deprecated as a consequence of Cache being deprecated.
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
public boolean
afterUpdate(Object key, Object value, Object version, SoftLock clientLock)

Implements org.hibernate.cache.CacheConcurrencyStrategy.afterUpdate.

Do nothing.
public void
clear()

Implements org.hibernate.cache.CacheConcurrencyStrategy.clear.

Evict all items from the cache immediately.
public void
public void
evict(Object key)

Implements org.hibernate.cache.CacheConcurrencyStrategy.evict.

Called after an item has become stale (before the transaction completes).
public Object
get(Object key, long
a timestamp prior to the transaction start time
txTimestamp
)

Implements org.hibernate.cache.CacheConcurrencyStrategy.get.

Attempt to retrieve an object from the cache.
public Cache
getCache()

Implements org.hibernate.cache.CacheConcurrencyStrategy.getCache.

Deprecated as a consequence of Cache being deprecated.
Get the wrapped cache implementation
public String
public boolean
insert(Object key, Object value, Object currentVersion)

Implements org.hibernate.cache.CacheConcurrencyStrategy.insert.

Called after an item has been inserted (before the transaction completes), instead of calling evict().
public SoftLock
lock(Object key, Object version)

Implements org.hibernate.cache.CacheConcurrencyStrategy.lock.

Do nothing, returning null.
public boolean
put(Object key, Object value, long
a timestamp prior to the transaction start time
txTimestamp
,
Object
the item version number
version
,
Comparator<T>
a comparator used to compare version numbers
versionComparator
,
boolean
indicates that the cache should avoid a put is the item is already cached
minimalPut
)

Implements org.hibernate.cache.CacheConcurrencyStrategy.put.

Attempt to cache an object, after loading from the database.
public void
public void
remove(Object key)

Implements org.hibernate.cache.CacheConcurrencyStrategy.remove.

Evict an item from the cache immediately (without regard for transaction isolation).
public void
setCache(Cache cache)

Implements org.hibernate.cache.CacheConcurrencyStrategy.setCache.

Deprecated as a consequence of Cache being deprecated.
Set the underlying cache implementation.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public boolean
update(Object key, Object value, Object currentVersion, Object previousVersion)

Implements org.hibernate.cache.CacheConcurrencyStrategy.update.

Called after an item has been updated (before the transaction completes), instead of calling evict().
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

cacheback to summary
private Cache cache

Deprecated

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

logback to summary
private static final Logger log

Constructor Detail

TransactionalCacheback to summary
public TransactionalCache()

Method Detail

afterInsertback to summary
public boolean afterInsert(Object key, Object value, Object version) throws CacheException

Implements org.hibernate.cache.CacheConcurrencyStrategy.afterInsert.

Do nothing.

afterUpdateback to summary
public boolean afterUpdate(Object key, Object value, Object version, SoftLock clientLock) throws CacheException

Implements org.hibernate.cache.CacheConcurrencyStrategy.afterUpdate.

Do nothing.

clearback to summary
public void clear() throws CacheException

Implements org.hibernate.cache.CacheConcurrencyStrategy.clear.

Doc from org.hibernate.cache.CacheConcurrencyStrategy.clear.

Evict all items from the cache immediately.

destroyback to summary
public void destroy()

Implements org.hibernate.cache.CacheConcurrencyStrategy.destroy.

Doc from org.hibernate.cache.CacheConcurrencyStrategy.destroy.

Clean up all resources.

evictback to summary
public void evict(Object key) throws CacheException

Implements org.hibernate.cache.CacheConcurrencyStrategy.evict.

Doc from org.hibernate.cache.CacheConcurrencyStrategy.evict.

Called after an item has become stale (before the transaction completes). This method is used by "synchronous" concurrency strategies.

getback to summary
public Object get(Object key, long txTimestamp) throws CacheException

Implements org.hibernate.cache.CacheConcurrencyStrategy.get.

Doc from org.hibernate.cache.CacheConcurrencyStrategy.get.

Attempt to retrieve an object from the cache. Mainly used in attempting to resolve entities/collections from the second level cache.

Parameters
txTimestamp:long

a timestamp prior to the transaction start time

Returns:Object

the cached object or null

getCacheback to summary
public Cache getCache()

Implements org.hibernate.cache.CacheConcurrencyStrategy.getCache.

Doc from org.hibernate.cache.CacheConcurrencyStrategy.getCache.

Deprecated

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

Get the wrapped cache implementation

getRegionNameback to summary
public String getRegionName()

Implements org.hibernate.cache.CacheConcurrencyStrategy.getRegionName.

Doc from org.hibernate.cache.CacheConcurrencyStrategy.getRegionName.

Get the cache region name

insertback to summary
public boolean insert(Object key, Object value, Object currentVersion) throws CacheException

Implements org.hibernate.cache.CacheConcurrencyStrategy.insert.

Doc from org.hibernate.cache.CacheConcurrencyStrategy.insert.

Called after an item has been inserted (before the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.

lockback to summary
public SoftLock lock(Object key, Object version) throws CacheException

Implements org.hibernate.cache.CacheConcurrencyStrategy.lock.

Do nothing, returning null.

putback to summary
public boolean put(Object key, Object value, long txTimestamp, Object version, Comparator<T> versionComparator, boolean minimalPut) throws CacheException

Implements org.hibernate.cache.CacheConcurrencyStrategy.put.

Doc from org.hibernate.cache.CacheConcurrencyStrategy.put.

Attempt to cache an object, after loading from the database.

Parameters
txTimestamp:long

a timestamp prior to the transaction start time

version:Object

the item version number

versionComparator:Comparator<T>

a comparator used to compare version numbers

minimalPut:boolean

indicates that the cache should avoid a put is the item is already cached

Returns:boolean

true if the object was successfully cached

releaseback to summary
public void release(Object key, SoftLock clientLock) throws CacheException

Implements org.hibernate.cache.CacheConcurrencyStrategy.release.

Do nothing.

removeback to summary
public void remove(Object key) throws CacheException

Implements org.hibernate.cache.CacheConcurrencyStrategy.remove.

Doc from org.hibernate.cache.CacheConcurrencyStrategy.remove.

Evict an item from the cache immediately (without regard for transaction isolation).

setCacheback to summary
public void setCache(Cache cache)

Implements org.hibernate.cache.CacheConcurrencyStrategy.setCache.

Doc from org.hibernate.cache.CacheConcurrencyStrategy.setCache.

Deprecated

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

Set the underlying cache implementation.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

updateback to summary
public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException

Implements org.hibernate.cache.CacheConcurrencyStrategy.update.

Doc from org.hibernate.cache.CacheConcurrencyStrategy.update.

Called after an item has been updated (before the transaction completes), instead of calling evict(). This method is used by "synchronous" concurrency strategies.