Top Description Fields Constructors Methods
org.hibernate.cache

public Class NonstrictReadWriteCache

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.

Caches data that is sometimes updated without ever locking the cache. If concurrent access to an item is possible, this concurrency strategy makes no guarantee that the item returned from the cache is the latest version available in the database. Configure your cache timeout accordingly! This is an "asynchronous" concurrency strategy.
Author
Gavin King
See Also
for a much stricter algorithm

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 lock)

Implements org.hibernate.cache.CacheConcurrencyStrategy.afterUpdate.

Invalidate the item (again, for safety).
public void
clear()

Implements org.hibernate.cache.CacheConcurrencyStrategy.clear.

Evict all items from the cache immediately.
public void
public void
public Object
get(Object key, long
a timestamp prior to the transaction start time
txTimestamp
)

Implements org.hibernate.cache.CacheConcurrencyStrategy.get.

Get the most recent version, if available.
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.

Invalidate the item
public SoftLock

Returns:

null, no lock
lock
(Object key, Object version)

Implements org.hibernate.cache.CacheConcurrencyStrategy.lock.

Do nothing.
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.

Add an item to the cache.
public void
release(Object key, SoftLock lock)

Implements org.hibernate.cache.CacheConcurrencyStrategy.release.

Invalidate the item (again, for safety).
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.

Do nothing.
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

NonstrictReadWriteCacheback to summary
public NonstrictReadWriteCache()

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 lock) throws CacheException

Implements org.hibernate.cache.CacheConcurrencyStrategy.afterUpdate.

Invalidate the item (again, for safety).

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.

Invalidate the item

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

Implements org.hibernate.cache.CacheConcurrencyStrategy.get.

Get the most recent version, if available.

Parameters
txTimestamp:long

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

a timestamp prior to the transaction start time

Returns:Object

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

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)

Implements org.hibernate.cache.CacheConcurrencyStrategy.insert.

Invalidate the item

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

Implements org.hibernate.cache.CacheConcurrencyStrategy.lock.

Do nothing.

Returns:SoftLock

null, no lock

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.

Add an item to the cache.

Parameters
txTimestamp:long

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

a timestamp prior to the transaction start time

version:Object

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

the item version number

versionComparator:Comparator<T>

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

a comparator used to compare version numbers

minimalPut:boolean

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

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

Returns:boolean

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

true if the object was successfully cached

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

Implements org.hibernate.cache.CacheConcurrencyStrategy.release.

Invalidate the item (again, for safety).

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)

Implements org.hibernate.cache.CacheConcurrencyStrategy.update.

Do nothing.