@Deprecated
public final class EhCache
extends java.lang.Object
implements org.hibernate.cache.Cache
MemoryStore
and a
DiskStore
.
The 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.
Modifier and Type | Field and Description |
---|---|
private Ehcache |
cache
Deprecated.
|
private CacheLockProvider |
lockProvider
Deprecated.
|
private static org.slf4j.Logger |
LOG
Deprecated.
|
private static int |
SIXTY_THOUSAND_MS
Deprecated.
|
Constructor and Description |
---|
EhCache(Ehcache cache)
Deprecated.
Creates a new Hibernate pluggable cache by name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canLockEntries()
Deprecated.
|
void |
clear()
Deprecated.
Remove all elements in the cache, but leave the cache in a useable state.
|
void |
destroy()
Deprecated.
Remove the cache and make it unuseable.
|
java.lang.Object |
get(java.lang.Object key)
Deprecated.
Gets a value of an element which matches the given key.
|
(package private) Ehcache |
getBackingCache()
Deprecated.
Package protected method used for testing
|
long |
getElementCountInMemory()
Deprecated.
|
long |
getElementCountOnDisk()
Deprecated.
|
java.lang.String |
getRegionName()
Deprecated.
|
long |
getSizeInMemory()
Deprecated.
Warning: This method can be very expensive to run.
|
int |
getTimeout()
Deprecated.
Returns the lock timeout for this cache, which is 60s
|
void |
lock(java.lang.Object key)
Deprecated.
|
long |
nextTimestamp()
Deprecated.
Gets the next timestamp;
|
void |
put(java.lang.Object key,
java.lang.Object value)
Deprecated.
Puts an object into the cache.
|
java.lang.Object |
read(java.lang.Object key)
Deprecated.
Gets an object from the cache.
|
void |
remove(java.lang.Object key)
Deprecated.
Removes the element which matches the key.
|
java.util.Map |
toMap()
Deprecated.
|
java.lang.String |
toString()
Deprecated.
|
void |
unlock(java.lang.Object key)
Deprecated.
|
void |
update(java.lang.Object key,
java.lang.Object value)
Deprecated.
Updates an object in the cache, or if it does not exist, inserts it.
|
private static final org.slf4j.Logger LOG
private static final int SIXTY_THOUSAND_MS
private final Ehcache cache
private final CacheLockProvider lockProvider
public EhCache(Ehcache cache)
cache
- The backing ehcache cache.public final java.lang.Object get(java.lang.Object key) throws org.hibernate.cache.CacheException
get
in interface org.hibernate.cache.Cache
key
- the key of the element to return.org.hibernate.cache.CacheException
public final java.lang.Object read(java.lang.Object key) throws org.hibernate.cache.CacheException
read
in interface org.hibernate.cache.Cache
key
- an Object valueorg.hibernate.cache.CacheException
public final void update(java.lang.Object key, java.lang.Object value) throws org.hibernate.cache.CacheException
update
in interface org.hibernate.cache.Cache
key
- an Object keyvalue
- an Object valueorg.hibernate.cache.CacheException
- if the CacheManager
is shutdown or another Exception
occurs.public final void put(java.lang.Object key, java.lang.Object value) throws org.hibernate.cache.CacheException
put
in interface org.hibernate.cache.Cache
key
- an Object keyvalue
- an Object valueorg.hibernate.cache.CacheException
- if the CacheManager
is shutdown or another Exception
occurs.public final void remove(java.lang.Object key) throws org.hibernate.cache.CacheException
remove
in interface org.hibernate.cache.Cache
key
- the key of the element to removeorg.hibernate.cache.CacheException
public final void clear() throws org.hibernate.cache.CacheException
clear
in interface org.hibernate.cache.Cache
org.hibernate.cache.CacheException
public final void destroy() throws org.hibernate.cache.CacheException
destroy
in interface org.hibernate.cache.Cache
org.hibernate.cache.CacheException
public final void lock(java.lang.Object key) throws org.hibernate.cache.CacheException
lock
in interface org.hibernate.cache.Cache
org.hibernate.cache.CacheException
public final void unlock(java.lang.Object key) throws org.hibernate.cache.CacheException
unlock
in interface org.hibernate.cache.Cache
org.hibernate.cache.CacheException
public final long nextTimestamp()
nextTimestamp
in interface org.hibernate.cache.Cache
public final int getTimeout()
getTimeout
in interface org.hibernate.cache.Cache
public final java.lang.String getRegionName()
getRegionName
in interface org.hibernate.cache.Cache
public final long getSizeInMemory()
getSizeInMemory
in interface org.hibernate.cache.Cache
public final long getElementCountInMemory()
getElementCountInMemory
in interface org.hibernate.cache.Cache
public final long getElementCountOnDisk()
getElementCountOnDisk
in interface org.hibernate.cache.Cache
public final java.util.Map toMap()
toMap
in interface org.hibernate.cache.Cache
public final boolean canLockEntries()
true
if this cache supports entry locks.public final java.lang.String toString()
toString
in class java.lang.Object
final Ehcache getBackingCache()