|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.tangosol.util.Base com.tangosol.coherence.hibernate.CoherenceCache
public class CoherenceCache
Provides a cache wrapper for storing Hibernate objects in Coherence NamedCache instances.
Field Summary | |
---|---|
protected static int |
DEFAULT_LOCK_LEASE_MILLIS
The default lock lease millis |
protected static int |
DEFAULT_LOCK_OBTAIN_MILLIS
The default lock attempt millis |
static String |
LOCK_LEASE_TIMEOUT
The system property specifying the lock lease timeout |
static String |
LOCK_OBTAIN_TIMEOUT
The system property specifying the lock acquisition timeout |
Constructor Summary | |
---|---|
CoherenceCache(NamedCache cache,
Properties properties)
Construct a Hibernate cache instance. |
Method Summary | |
---|---|
void |
clear()
Clear the entire cache. |
void |
destroy()
Release local (JVM) resources associated with this cache. |
Object |
get(Object oKey)
Get an object from the cache. |
long |
getElementCountInMemory()
Get the size of the cache in memory (object count) |
long |
getElementCountOnDisk()
Get the size of the cache on disk (object count) |
protected int |
getLockLeaseTimeout()
Get the timeout (in millis) for lock leases. |
protected int |
getLockObtainTimeout()
Get the timeout (in millis) for lock acquisition attempts. |
String |
getRegionName()
Get the region (cache) name. |
long |
getSizeInMemory()
Get the size of the cache in memory (byte count) |
int |
getTimeout()
Get the lock timeout (lease duration, not lock acquisition). |
protected long |
getTimeProperty(Properties properties,
String sPropertyName,
long cDefaultMillis,
long cMaxMillis)
Get an adjusted time (duration) property |
void |
lock(Object oKey)
Lock a key. |
long |
nextTimestamp()
Get the current timestamp (in millis). |
void |
put(Object oKey,
Object oValue)
Put an object into the cache. |
Object |
read(Object oKey)
Get an object from the cache. |
void |
remove(Object oKey)
Remove an object from the cache. |
Map |
toMap()
Get a Map instance representing the contents of the cache. |
void |
unlock(Object oKey)
Unlock a key. |
void |
update(Object oKey,
Object oValue)
Update an item in the cache. |
Field Detail |
---|
public static final String LOCK_OBTAIN_TIMEOUT
protected static final int DEFAULT_LOCK_OBTAIN_MILLIS
public static final String LOCK_LEASE_TIMEOUT
protected static final int DEFAULT_LOCK_LEASE_MILLIS
Constructor Detail |
---|
public CoherenceCache(NamedCache cache, Properties properties)
cache
- the Coherence NamedCache instance that provides the
actual data storageproperties
- the configuration propertiesMethod Detail |
---|
public Object get(Object oKey)
get
in interface org.hibernate.cache.Cache
oKey
- the cache key
public Object read(Object oKey)
read
in interface org.hibernate.cache.Cache
oKey
- the cache key
public void put(Object oKey, Object oValue)
put
in interface org.hibernate.cache.Cache
oKey
- the cache keyoValue
- the cache valuepublic void remove(Object oKey)
remove
in interface org.hibernate.cache.Cache
oKey
- the cache keypublic void clear()
clear
in interface org.hibernate.cache.Cache
public void destroy()
destroy
in interface org.hibernate.cache.Cache
public int getTimeout()
getTimeout
in interface org.hibernate.cache.Cache
public long nextTimestamp()
nextTimestamp
in interface org.hibernate.cache.Cache
public void lock(Object oKey)
lock
in interface org.hibernate.cache.Cache
oKey
- the cache key
org.hibernate.cache.CacheException
- if lock acquisition times outpublic void unlock(Object oKey)
unlock
in interface org.hibernate.cache.Cache
oKey
- the cache keypublic void update(Object oKey, Object oValue)
update
in interface org.hibernate.cache.Cache
oKey
- the cache keyoValue
- the cache valuepublic String getRegionName()
getRegionName
in interface org.hibernate.cache.Cache
public long getSizeInMemory()
Not supported (returns -1).
Note: Used only by the Cache Statistics package
getSizeInMemory
in interface org.hibernate.cache.Cache
public long getElementCountInMemory()
Not supported (returns total cache size, including disk).
Note: Used only by the Cache Statistics package
getElementCountInMemory
in interface org.hibernate.cache.Cache
public long getElementCountOnDisk()
Not supported (returns -1).
Note: Used only by the Cache Statistics package
getElementCountOnDisk
in interface org.hibernate.cache.Cache
public Map toMap()
This implementation simply returns the Coherence NamedCache instance.
toMap
in interface org.hibernate.cache.Cache
protected int getLockObtainTimeout()
protected int getLockLeaseTimeout()
protected long getTimeProperty(Properties properties, String sPropertyName, long cDefaultMillis, long cMaxMillis)
properties
- the property set containing the propertysPropertyName
- the name of the propertycDefaultMillis
- the default value (in milliseconds)cMaxMillis
- the maximum value (saturating, in milliseconds)
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |