com.opensymphony.oscache.hibernate
Class OSCache

java.lang.Object
  extended by com.opensymphony.oscache.hibernate.OSCache
All Implemented Interfaces:
org.hibernate.cache.Cache

public class OSCache
extends Object
implements org.hibernate.cache.Cache

Cache plugin for Hibernate 3.2 and OpenSymphony OSCache 2.4.

The OSCache implementation assumes that identifiers have well-behaved toString() methods. This implementation must be threadsafe.

Version:
$Revision:$

Constructor Summary
OSCache(GeneralCacheAdministrator cache, int refreshPeriod, String cron, String region)
           
 
Method Summary
 void clear()
           
 void destroy()
           
 Object get(Object key)
           
 long getElementCountInMemory()
           
 long getElementCountOnDisk()
           
 String getRegionName()
           
 long getSizeInMemory()
           
 int getTimeout()
           
 void lock(Object key)
           
 long nextTimestamp()
           
 void put(Object key, Object value)
           
 Object read(Object key)
           
 void remove(Object key)
           
 Map toMap()
           
 void unlock(Object key)
           
 void update(Object key, Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OSCache

public OSCache(GeneralCacheAdministrator cache,
               int refreshPeriod,
               String cron,
               String region)
Method Detail

get

public Object get(Object key)
           throws org.hibernate.cache.CacheException
Specified by:
get in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException
See Also:
Cache.get(java.lang.Object)

put

public void put(Object key,
                Object value)
         throws org.hibernate.cache.CacheException
Specified by:
put in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException
See Also:
Cache.put(java.lang.Object, java.lang.Object)

remove

public void remove(Object key)
            throws org.hibernate.cache.CacheException
Specified by:
remove in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException
See Also:
Cache.remove(java.lang.Object)

clear

public void clear()
           throws org.hibernate.cache.CacheException
Specified by:
clear in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException
See Also:
Cache.clear()

destroy

public void destroy()
             throws org.hibernate.cache.CacheException
Specified by:
destroy in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException
See Also:
Cache.destroy()

lock

public void lock(Object key)
          throws org.hibernate.cache.CacheException
Specified by:
lock in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException
See Also:
Cache.lock(java.lang.Object)

unlock

public void unlock(Object key)
            throws org.hibernate.cache.CacheException
Specified by:
unlock in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException
See Also:
Cache.unlock(java.lang.Object)

nextTimestamp

public long nextTimestamp()
Specified by:
nextTimestamp in interface org.hibernate.cache.Cache
See Also:
Cache.nextTimestamp()

getTimeout

public int getTimeout()
Specified by:
getTimeout in interface org.hibernate.cache.Cache
See Also:
Cache.getTimeout()

toMap

public Map toMap()
Specified by:
toMap in interface org.hibernate.cache.Cache
See Also:
Cache.toMap()

getElementCountOnDisk

public long getElementCountOnDisk()
Specified by:
getElementCountOnDisk in interface org.hibernate.cache.Cache
See Also:
Cache.getElementCountOnDisk()

getElementCountInMemory

public long getElementCountInMemory()
Specified by:
getElementCountInMemory in interface org.hibernate.cache.Cache
See Also:
Cache.getElementCountInMemory()

getSizeInMemory

public long getSizeInMemory()
Specified by:
getSizeInMemory in interface org.hibernate.cache.Cache
See Also:
Cache.getSizeInMemory()

getRegionName

public String getRegionName()
Specified by:
getRegionName in interface org.hibernate.cache.Cache
See Also:
Cache.getRegionName()

update

public void update(Object key,
                   Object value)
            throws org.hibernate.cache.CacheException
Specified by:
update in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException
See Also:
Cache.update(java.lang.Object, java.lang.Object)

read

public Object read(Object key)
            throws org.hibernate.cache.CacheException
Specified by:
read in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException
See Also:
Cache.read(java.lang.Object)

OSCache Project Page