Top Description Fields Constructors Methods
net.sf.ehcache.hibernate.ccs

public Class EhcacheReadOnlyCache

extends AbstractEhcacheConcurrencyStrategy
Class Inheritance
Annotations
@Deprecated
Imports
java.util.Comparator, org.hibernate.cache.CacheException, org.slf4j.Logger, .LoggerFactory, org.hibernate.cache.access.SoftLock

Deprecated

Ehcache specific read-only cache concurrency strategy.

This is the Ehcache specific equivalent to Hibernate's ReadOnlyCache.

Author
Chris Dennis

Field Summary

Modifier and TypeField and Description
private static final Logger
Inherited from net.sf.ehcache.hibernate.ccs.AbstractEhcacheConcurrencyStrategy:
cache

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
afterInsert(Object key, Object value, Object version)

Implements org.hibernate.cache.CacheConcurrencyStrategy.afterInsert.

Inserts the specified item into the cache.
public boolean
afterUpdate(Object key, Object value, Object version, SoftLock lock)

Implements org.hibernate.cache.CacheConcurrencyStrategy.afterUpdate.

Throws UnsupportedOperationException since items in a read-only cache should not be mutated.
public void
evict(Object key)

Implements org.hibernate.cache.CacheConcurrencyStrategy.evict.

A No-Op, since we are an asynchronous cache concurrency strategy.
public Object
get(Object key, long
a timestamp prior to the transaction start time
timestamp
)

Implements org.hibernate.cache.CacheConcurrencyStrategy.get.

Attempt to retrieve an object from the cache.
public boolean
insert(Object key, Object value, Object currentVersion)

Implements org.hibernate.cache.CacheConcurrencyStrategy.insert.

A No-Op, since we are an asynchronous cache concurrency strategy.
public SoftLock
lock(Object key, Object version)

Implements org.hibernate.cache.CacheConcurrencyStrategy.lock.

Throws UnsupportedOperationException since items in a read-only cache should not be mutated.
public boolean
put(Object key, Object value, long
a timestamp prior to the transaction start time
timestamp
,
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
release(Object key, SoftLock lock)

Implements org.hibernate.cache.CacheConcurrencyStrategy.release.

Logs an error since items in a read-only cache should not be mutated.
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.

Throws UnsupportedOperationException since items in a read-only cache should not be mutated.
Inherited from net.sf.ehcache.hibernate.ccs.AbstractEhcacheConcurrencyStrategy:
cleardestroygetCachegetRegionNameremovesetCache

Field Detail

LOGback to summary
private static final Logger LOG

Hides net.sf.ehcache.hibernate.ccs.AbstractEhcacheConcurrencyStrategy.LOG.

Constructor Detail

EhcacheReadOnlyCacheback to summary
public EhcacheReadOnlyCache()

Method Detail

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

Implements org.hibernate.cache.CacheConcurrencyStrategy.afterInsert.

Inserts the specified item into the cache.

afterUpdateback to summary
public boolean afterUpdate(Object key, Object value, Object version, SoftLock lock) throws UnsupportedOperationException

Implements org.hibernate.cache.CacheConcurrencyStrategy.afterUpdate.

Throws UnsupportedOperationException since items in a read-only cache should not be mutated.

Exceptions
UnsupportedOperationException:
always
evictback to summary
public void evict(Object key) throws CacheException

Implements org.hibernate.cache.CacheConcurrencyStrategy.evict.

A No-Op, since we are an asynchronous cache concurrency strategy.

getback to summary
public Object get(Object key, long timestamp) 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
timestamp:long

a timestamp prior to the transaction start time

Returns:Object

the cached object or null

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

Implements org.hibernate.cache.CacheConcurrencyStrategy.insert.

A No-Op, since we are an asynchronous cache concurrency strategy.

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

Implements org.hibernate.cache.CacheConcurrencyStrategy.lock.

Throws UnsupportedOperationException since items in a read-only cache should not be mutated.

Exceptions
UnsupportedOperationException:
always
putback to summary
public boolean put(Object key, Object value, long timestamp, 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
timestamp: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 lock)

Implements org.hibernate.cache.CacheConcurrencyStrategy.release.

Logs an error since items in a read-only cache should not be mutated.

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.

Annotations
@Override
updateback to summary
public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws UnsupportedOperationException

Implements org.hibernate.cache.CacheConcurrencyStrategy.update.

Throws UnsupportedOperationException since items in a read-only cache should not be mutated.

Exceptions
UnsupportedOperationException:
always