com.hazelcast.hibernate.provider
Class HazelcastCache

java.lang.Object
  extended by com.hazelcast.hibernate.provider.HazelcastCache
All Implemented Interfaces:
org.hibernate.cache.Cache

public final class HazelcastCache
extends Object
implements org.hibernate.cache.Cache

Implementation of (deprecated) Hibernate Cache interface for compatibility with pre-Hibernate 3.3.x code.

Author:
Leo Kim (lkim@limewire.com)
See Also:
HazelcastCacheProvider, HazelcastCacheRegionFactory

Constructor Summary
HazelcastCache(HazelcastInstance instance, String regionName)
           
 
Method Summary
 void clear()
           
 void destroy()
           
 Object get(Object key)
           
 long getElementCountInMemory()
           
 long getElementCountOnDisk()
          Hazelcast does not support pushing elements to disk.
 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

HazelcastCache

public HazelcastCache(HazelcastInstance instance,
                      String regionName)
Method Detail

clear

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

destroy

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

getElementCountInMemory

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

getElementCountOnDisk

public long getElementCountOnDisk()
Hazelcast does not support pushing elements to disk.

Specified by:
getElementCountOnDisk in interface org.hibernate.cache.Cache
Returns:
-1 this value means "unsupported"

getRegionName

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

getSizeInMemory

public long getSizeInMemory()
Specified by:
getSizeInMemory in interface org.hibernate.cache.Cache
Returns:
a rough estimate of number of bytes used by this region.

getTimeout

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

nextTimestamp

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

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

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

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

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

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

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

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

toMap

public Map toMap()
Specified by:
toMap in interface org.hibernate.cache.Cache
Returns:
the internal IMap used for this cache.


Copyright © 2011 Hazel Bilisim Ltd.. All Rights Reserved.