net.sf.ehcache.hibernate
public final class EhCache extends Object implements Cache
Version: $Id: EhCache.java 53 2006-04-25 08:56:21Z gregluck $
Constructor Summary | |
---|---|
EhCache(Cache cache)
Creates a new Hibernate pluggable cache by 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.
|
Cache | getBackingCache()
Package protected method used for testing |
long | getElementCountInMemory() |
long | getElementCountOnDisk() |
String | getRegionName() |
long | getSizeInMemory()
Warning: This method can be very expensive to run. |
int | getTimeout()
Returns the lock timeout for this cache, which is 60s |
void | lock(Object key)
Calls to this method should perform their own synchronization.
|
long | nextTimestamp()
Gets the next timestamp; |
void | put(Object key, Object value)
Puts an object into the cache.
|
Object | read(Object key)
Gets an object from the cache.
|
void | remove(Object key)
Removes the element which matches the key.
|
Map | toMap() |
String | toString() |
void | unlock(Object key)
Calls to this method should perform their own synchronization.
|
void | update(Object key, Object value)
Updates an object in the cache, or if it does not exist, inserts it.
|
Parameters: cache The backing ehcache cache.
Throws: CacheException
Throws: CacheException
Parameters: key the key of the element to return.
Returns: The value placed into the cache with an earlier put, or null if not found or expired
Throws: org.hibernate.cache.CacheException
Returns: the number of elements in ehcache's MemoryStore
Returns: the number of elements in ehcache's DiskStore. 0 is there is no DiskStore
Returns: the region name of the cache, which is the cache name in ehcache
Returns: the approximate size of memory ehcache is using for the MemoryStore for this cache
Parameters: key an Object key value an Object value
Throws: CacheException if the CacheManager is shutdown or another Exception occurs.
Parameters: key an Object value
Returns: the Object, or null if not found
Throws: CacheException
Parameters: key the key of the element to remove
Throws: CacheException
Returns: a copy of the cache Elements as a Map
Returns: the region name, which is the cache name in ehcache
Parameters: key an Object key value an Object value
Throws: CacheException if the CacheManager is shutdown or another Exception occurs.