public class

TransactionalCache

extends Object
implements CacheConcurrencyStrategy
java.lang.Object
   ↳ org.hibernate.cache.TransactionalCache

Class Overview

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.

Summary

Public Constructors
TransactionalCache()
Public Methods
boolean afterInsert(Object key, Object value, Object version)
Do nothing.
boolean afterUpdate(Object key, Object value, Object version, SoftLock clientLock)
Do nothing.
void clear()
Evict all items from the cache immediately.
void destroy()
Clean up all resources.
void evict(Object key)
Called after an item has become stale (before the transaction completes).
Object get(Object key, long txTimestamp)
Attempt to retrieve an object from the cache.
Cache getCache()
Get the wrapped cache implementation
String getRegionName()
Get the cache region name
boolean insert(Object key, Object value, Object currentVersion)
Called after an item has been inserted (before the transaction completes), instead of calling evict().
SoftLock lock(Object key, Object version)
Do nothing, returning null.
boolean put(Object key, Object value, long txTimestamp, Object version, Comparator versionComparator, boolean minimalPut)
Attempt to cache an object, after loading from the database.
void release(Object key, SoftLock clientLock)
Do nothing.
void remove(Object key)
Evict an item from the cache immediately (without regard for transaction isolation).
void setCache(Cache cache)
Set the underlying cache implementation.
String toString()
boolean update(Object key, Object value, Object currentVersion, Object previousVersion)
Called after an item has been updated (before the transaction completes), instead of calling evict().
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.hibernate.cache.CacheConcurrencyStrategy

Public Constructors

public TransactionalCache ()

Public Methods

public boolean afterInsert (Object key, Object value, Object version)

Do nothing.

public boolean afterUpdate (Object key, Object value, Object version, SoftLock clientLock)

Do nothing.

public void clear ()

Evict all items from the cache immediately.

public void destroy ()

Clean up all resources.

public void evict (Object key)

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

public Object get (Object key, long txTimestamp)

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

Parameters
txTimestamp a timestamp prior to the transaction start time
Returns
  • the cached object or null

public Cache getCache ()

Get the wrapped cache implementation

public String getRegionName ()

Get the cache region name

public boolean insert (Object key, Object value, Object currentVersion)

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

public SoftLock lock (Object key, Object version)

Do nothing, returning null.

public boolean put (Object key, Object value, long txTimestamp, Object version, Comparator versionComparator, boolean minimalPut)

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

Parameters
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
Returns
  • true if the object was successfully cached

public void release (Object key, SoftLock clientLock)

Do nothing.

public void remove (Object key)

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

public void setCache (Cache cache)

Set the underlying cache implementation.

public String toString ()

public boolean update (Object key, Object value, Object currentVersion, Object previousVersion)

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