|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.cache.EhCache
public class EhCache
EHCache plugin for Hibernate
EHCache uses anet.sf.ehcache.store.MemoryStore
and a
net.sf.ehcache.store.DiskStore
.
The net.sf.ehcache.store.DiskStore
requires that both keys and values be Serializable
.
However the MemoryStore does not and in ehcache-1.2 nonSerializable Objects are permitted. They are discarded
if an attempt it made to overflow them to Disk or to replicate them to remote cache peers.
Constructor Summary | |
---|---|
EhCache(net.sf.ehcache.Ehcache cache)
Creates a new Hibernate pluggable cache based on a cache name. |
Method Summary | |
---|---|
void |
clear()
Remove all elements in the cache, but leave the cache in a useable state. |
void |
destroy()
Remove the cache and make it unuseable. |
Object |
get(Object key)
Gets a value of an element which matches the given key. |
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()
Warning: This method can be very expensive to run. |
int |
getTimeout()
Returns the lock timeout for this cache. |
void |
lock(Object key)
Calls to this method should perform there own synchronization. |
long |
nextTimestamp()
Gets the next timestamp; |
void |
put(Object key,
Object value)
Puts an object into the cache. |
Object |
read(Object key)
Get an item from the cache |
void |
remove(Object key)
Removes the element which matches the key. |
Map |
toMap()
optional operation |
String |
toString()
|
void |
unlock(Object key)
Calls to this method should perform there own synchronization. |
void |
update(Object key,
Object value)
Puts an object into the cache. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public EhCache(net.sf.ehcache.Ehcache cache)
cache
- The underlying EhCache instance to use.Method Detail |
---|
public Object get(Object key) throws CacheException
get
in interface Cache
key
- the key of the element to return.
CacheException
public Object read(Object key) throws CacheException
Cache
read
in interface Cache
CacheException
public void update(Object key, Object value) throws CacheException
update
in interface Cache
key
- a keyvalue
- a value
CacheException
- if the CacheManager
is shutdown or another Exception
occurs.public void put(Object key, Object value) throws CacheException
put
in interface Cache
key
- a keyvalue
- a value
CacheException
- if the CacheManager
is shutdown or another Exception
occurs.public void remove(Object key) throws CacheException
remove
in interface Cache
key
- the key of the element to remove
CacheException
public void clear() throws CacheException
clear
in interface Cache
CacheException
public void destroy() throws CacheException
destroy
in interface Cache
CacheException
public void lock(Object key) throws CacheException
lock
in interface Cache
CacheException
public void unlock(Object key) throws CacheException
unlock
in interface Cache
CacheException
public long nextTimestamp()
nextTimestamp
in interface Cache
public int getTimeout()
getTimeout
in interface Cache
public String getRegionName()
Cache
getRegionName
in interface Cache
public long getSizeInMemory()
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 |