|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.hibernate.cache.NonstrictReadWriteCache
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.
for a much stricter algorithm
Nested Class Summary |
Nested classes inherited from class net.sf.hibernate.cache.CacheConcurrencyStrategy |
CacheConcurrencyStrategy.SoftLock |
Constructor Summary | |
NonstrictReadWriteCache()
|
Method Summary | |
void |
afterInsert(Object key,
Object value,
Object version)
Do nothing. |
void |
afterUpdate(Object key,
Object value,
Object version,
CacheConcurrencyStrategy.SoftLock lock)
Invalidate the item (again, for safety). |
void |
clear()
Evict all items from the cache immediately. |
void |
destroy()
Clean up all resources. |
void |
evict(Object key)
Invalidate the item |
Object |
get(Object key,
long txTimestamp)
Get the most recent version, if available. |
void |
insert(Object key,
Object value)
Do nothing. |
CacheConcurrencyStrategy.SoftLock |
lock(Object key,
Object version)
Do nothing. |
boolean |
put(Object key,
Object value,
long txTimestamp,
Object version,
Comparator versionComparator)
Add an item to the cache. |
void |
release(Object key,
CacheConcurrencyStrategy.SoftLock lock)
Invalidate the item (again, for safety). |
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. |
void |
setMinimalPuts(boolean minimalPuts)
Enable "minimal puts" mode for this cache |
void |
update(Object key,
Object value)
Invalidate the item |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public NonstrictReadWriteCache()
Method Detail |
public void setCache(Cache cache)
CacheConcurrencyStrategy
setCache
in interface CacheConcurrencyStrategy
cache
- public Object get(Object key, long txTimestamp) throws CacheException
get
in interface CacheConcurrencyStrategy
key
- txTimestamp
- a timestamp prior to the transaction start time
CacheException
public boolean put(Object key, Object value, long txTimestamp, Object version, Comparator versionComparator) throws CacheException
put
in interface CacheConcurrencyStrategy
key
- value
- txTimestamp
- a timestamp prior to the transaction start timeversion
- the version number of the object we are puttingversionComparator
- a Comparator to be used to compare version numbers
CacheException
public CacheConcurrencyStrategy.SoftLock lock(Object key, Object version) throws CacheException
lock
in interface CacheConcurrencyStrategy
key
- version
-
CacheException
public void remove(Object key) throws CacheException
CacheConcurrencyStrategy
remove
in interface CacheConcurrencyStrategy
key
-
CacheException
public void clear() throws CacheException
CacheConcurrencyStrategy
clear
in interface CacheConcurrencyStrategy
CacheException
public void destroy()
CacheConcurrencyStrategy
destroy
in interface CacheConcurrencyStrategy
public void evict(Object key) throws CacheException
evict
in interface CacheConcurrencyStrategy
CacheException
public void update(Object key, Object value) throws CacheException
update
in interface CacheConcurrencyStrategy
CacheException
public void insert(Object key, Object value) throws CacheException
insert
in interface CacheConcurrencyStrategy
CacheException
public void release(Object key, CacheConcurrencyStrategy.SoftLock lock) throws CacheException
release
in interface CacheConcurrencyStrategy
key
-
CacheException
public void afterUpdate(Object key, Object value, Object version, CacheConcurrencyStrategy.SoftLock lock) throws CacheException
afterUpdate
in interface CacheConcurrencyStrategy
CacheException
public void afterInsert(Object key, Object value, Object version) throws CacheException
afterInsert
in interface CacheConcurrencyStrategy
CacheException
public void setMinimalPuts(boolean minimalPuts) throws HibernateException
CacheConcurrencyStrategy
setMinimalPuts
in interface CacheConcurrencyStrategy
HibernateException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |