|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.cache.OptimisticTreeCache
public class OptimisticTreeCache
Represents a particular region within the given JBossCache TreeCache utilizing TreeCache's optimistic locking capabilities.
for more details
Nested Class Summary | |
---|---|
static class |
OptimisticTreeCache.CircumventChecksDataVersion
Used to signal to a DataVersionAdapter to simply not perform any checks. |
static class |
OptimisticTreeCache.DataVersionAdapter
|
static class |
OptimisticTreeCache.NonLockingDataVersion
Used in regions where no locking should ever occur. |
Constructor Summary | |
---|---|
OptimisticTreeCache(org.jboss.cache.TreeCache cache,
String regionName)
|
Method Summary | |
---|---|
void |
clear()
Clear the cache |
void |
destroy()
Clean up |
Object |
get(Object key)
Get an item from the cache, nontransactionally |
long |
getElementCountInMemory()
The count of entries currently contained in the regions in-memory store. |
long |
getElementCountOnDisk()
The count of entries currently contained in the regions disk store. |
String |
getRegionName()
Get the name of the cache region |
long |
getSizeInMemory()
The number of bytes is this cache region currently consuming in memory. |
int |
getTimeout()
Get a reasonable "lock timeout" |
void |
lock(Object key)
If this is a clustered cache, lock the item |
long |
nextTimestamp()
Generate a timestamp |
void |
put(Object key,
Object value)
Add an item to the cache, nontransactionally, with failfast semantics |
Object |
read(Object key)
Get an item from the cache |
void |
remove(Object key)
Remove an item from the cache |
void |
setSource(OptimisticCacheSource source)
Indicates the "source" of the cached data. |
Map |
toMap()
optional operation |
String |
toString()
|
void |
unlock(Object key)
If this is a clustered cache, unlock the item |
void |
update(Object key,
Object value)
Add an item to the cache |
void |
writeInsert(Object key,
Object value,
Object currentVersion)
Called during CacheConcurrencyStrategy.insert(java.lang.Object, java.lang.Object, java.lang.Object) processing for
transactional strategies. |
void |
writeLoad(Object key,
Object value,
Object currentVersion)
Called during CacheConcurrencyStrategy.put(java.lang.Object, java.lang.Object, long, java.lang.Object, java.util.Comparator, boolean) processing for
transactional strategies. |
void |
writeUpdate(Object key,
Object value,
Object currentVersion,
Object previousVersion)
Called during CacheConcurrencyStrategy.update(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object) processing for
transactional strategies. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public OptimisticTreeCache(org.jboss.cache.TreeCache cache, String regionName) throws CacheException
CacheException
Method Detail |
---|
public void setSource(OptimisticCacheSource source)
OptimisticCache
EntityPersister
.
Made available to the cache so that it can access certain information
about versioning strategy.
setSource
in interface OptimisticCache
source
- The source.public void writeInsert(Object key, Object value, Object currentVersion)
OptimisticCache
CacheConcurrencyStrategy.insert(java.lang.Object, java.lang.Object, java.lang.Object)
processing for
transactional strategies. Indicates we have just performed an insert
into the DB and now need to cache that entity's data.
writeInsert
in interface OptimisticCache
key
- The cache key.value
- The data to be cached.currentVersion
- The entity's version; or null if not versioned.public void writeUpdate(Object key, Object value, Object currentVersion, Object previousVersion)
OptimisticCache
CacheConcurrencyStrategy.update(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object)
processing for
transactional strategies. Indicates we have just performed an update
against the DB and now need to cache the updated state.
writeUpdate
in interface OptimisticCache
key
- The cache key.value
- The data to be cached.currentVersion
- The entity's current versionpreviousVersion
- The entity's previous version (before the update);
or null if not versioned.public void writeLoad(Object key, Object value, Object currentVersion)
OptimisticCache
CacheConcurrencyStrategy.put(java.lang.Object, java.lang.Object, long, java.lang.Object, java.util.Comparator, boolean)
processing for
transactional strategies. Indicates we have just loaded an entity's
state from the database and need it cached.
writeLoad
in interface OptimisticCache
key
- The cache key.value
- The data to be cached.currentVersion
- The entity's version; or null if not versioned.public Object get(Object key) throws CacheException
Cache
get
in interface Cache
CacheException
public Object read(Object key) throws CacheException
Cache
read
in interface Cache
CacheException
public void update(Object key, Object value) throws CacheException
Cache
update
in interface Cache
CacheException
public void put(Object key, Object value) throws CacheException
Cache
put
in interface Cache
CacheException
public void remove(Object key) throws CacheException
Cache
remove
in interface Cache
CacheException
public void clear() throws CacheException
Cache
clear
in interface Cache
CacheException
public void destroy() throws CacheException
Cache
destroy
in interface Cache
CacheException
public void lock(Object key) throws CacheException
Cache
lock
in interface Cache
CacheException
public void unlock(Object key) throws CacheException
Cache
unlock
in interface Cache
CacheException
public long nextTimestamp()
Cache
nextTimestamp
in interface Cache
public int getTimeout()
Cache
getTimeout
in interface Cache
public String getRegionName()
Cache
getRegionName
in interface Cache
public long getSizeInMemory()
Cache
getSizeInMemory
in interface Cache
public long getElementCountInMemory()
Cache
getElementCountInMemory
in interface Cache
public long getElementCountOnDisk()
Cache
getElementCountOnDisk
in interface Cache
public Map toMap()
Cache
toMap
in interface Cache
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |