ehcache

net.sf.ehcache.hibernate
Class EhCache

java.lang.Object
  extended by net.sf.ehcache.hibernate.EhCache

Deprecated.

@Deprecated
public final class EhCache
extends Object

EHCache plugin for Hibernate.

EHCache uses a 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.

Version:
$Id: EhCache.java 6929 2013-01-19 14:20:39Z cdennis $
Author:
Greg Luck, Emmanuel Bernard

Constructor Summary
EhCache(Ehcache cache)
          Deprecated. Creates a new Hibernate pluggable cache by name.
 
Method Summary
 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.
 Object get(Object key)
          Deprecated. Gets a value of an element which matches the given key.
 long getElementCountInMemory()
          Deprecated.  
 long getElementCountOnDisk()
          Deprecated.  
 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(Object key)
          Deprecated. 
 long nextTimestamp()
          Deprecated. Gets the next timestamp;
 void put(Object key, Object value)
          Deprecated. Puts an object into the cache.
 Object read(Object key)
          Deprecated. Gets an object from the cache.
 void remove(Object key)
          Deprecated. Removes the element which matches the key.
 Map toMap()
          Deprecated.  
 String toString()
          Deprecated.  
 void unlock(Object key)
          Deprecated. 
 void update(Object key, Object value)
          Deprecated. Updates an object in the cache, or if it does not exist, inserts it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EhCache

public EhCache(Ehcache cache)
Deprecated. 
Creates a new Hibernate pluggable cache by name.

ehcache will look in ehcache.xml to load the configuration for the cache. If the cache is not there, it will use the defaultCache settings. It is always a good idea to specifically configure each cache.

Parameters:
cache - The backing ehcache cache.
Method Detail

get

public final Object get(Object key)
                 throws CacheException
Deprecated. 
Gets a value of an element which matches the given key.

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
CacheException

read

public final Object read(Object key)
                  throws CacheException
Deprecated. 
Gets an object from the cache.

Parameters:
key - an Object value
Returns:
the Object, or null if not found
Throws:
CacheException

update

public final void update(Object key,
                         Object value)
                  throws CacheException
Deprecated. 
Updates an object in the cache, or if it does not exist, inserts it.

Parameters:
key - an Object key
value - an Object value
Throws:
CacheException - if the CacheManager is shutdown or another Exception occurs.

put

public final void put(Object key,
                      Object value)
               throws CacheException
Deprecated. 
Puts an object into the cache.

Parameters:
key - an Object key
value - an Object value
Throws:
CacheException - if the CacheManager is shutdown or another Exception occurs.

remove

public final void remove(Object key)
                  throws CacheException
Deprecated. 
Removes the element which matches the key.

If no element matches, nothing is removed and no Exception is thrown.

Parameters:
key - the key of the element to remove
Throws:
CacheException

clear

public final void clear()
                 throws CacheException
Deprecated. 
Remove all elements in the cache, but leave the cache in a useable state.

Throws:
CacheException

destroy

public final void destroy()
                   throws CacheException
Deprecated. 
Remove the cache and make it unuseable.

Throws:
CacheException

lock

public final void lock(Object key)
                throws CacheException
Deprecated. 

Throws:
CacheException

unlock

public final void unlock(Object key)
                  throws CacheException
Deprecated. 

Throws:
CacheException

nextTimestamp

public final long nextTimestamp()
Deprecated. 
Gets the next timestamp;


getTimeout

public final int getTimeout()
Deprecated. 
Returns the lock timeout for this cache, which is 60s


getRegionName

public final String getRegionName()
Deprecated. 
Returns:
the region name of the cache, which is the cache name in ehcache

getSizeInMemory

public final long getSizeInMemory()
Deprecated. 
Warning: This method can be very expensive to run. Allow approximately 1 second per 1MB of entries. Running this method could create liveness problems because the object lock is held for a long period

Returns:
the approximate size of memory ehcache is using for the MemoryStore for this cache

getElementCountInMemory

public final long getElementCountInMemory()
Deprecated. 
Returns:
the number of elements in ehcache's MemoryStore

getElementCountOnDisk

public final long getElementCountOnDisk()
Deprecated. 
Returns:
the number of elements in ehcache's DiskStore. 0 is there is no DiskStore

toMap

public final Map toMap()
Deprecated. 
Returns:
a copy of the cache Elements as a Map

canLockEntries

public final boolean canLockEntries()
Deprecated. 
Returns:
true if this cache supports entry locks.

toString

public final String toString()
Deprecated. 
Overrides:
toString in class Object
Returns:
the region name, which is the cache name in ehcache

ehcache

Copyright 2001-2015, Terracotta, Inc.