org.hibernate.cache
Class SwarmCache

java.lang.Object
  extended by org.hibernate.cache.SwarmCache
All Implemented Interfaces:
Cache

public class SwarmCache
extends Object
implements Cache

Author:
Jason Carreira, Gavin King

Constructor Summary
SwarmCache(net.sf.swarmcache.ObjectCache cache, String regionName)
           
 
Method Summary
 void clear()
          Clear the cache
 void destroy()
          Clean up
 Object get(Object key)
          Get an item from the cache
 long getElementCountInMemory()
           
 long getElementCountOnDisk()
           
 String getRegionName()
           
 long getSizeInMemory()
           
 int getTimeout()
          Get a reasonable "lock timeout"
 void lock(Object key)
          If this is a clustered cache, lock the item
 long nextTimestamp()
          Generate a (coarse) timestamp
 void put(Object key, Object value)
          Add an item to the cache
 Object read(Object key)
           
 void remove(Object key)
          Remove an item from the cache
 Map toMap()
           
 String toString()
           
 void unlock(Object key)
          If this is a clustered cache, unlock the item
 void update(Object key, Object value)
          Add an item to the cache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SwarmCache

public SwarmCache(net.sf.swarmcache.ObjectCache cache,
                  String regionName)
Method Detail

get

public Object get(Object key)
           throws CacheException
Get an item from the cache

Specified by:
get in interface Cache
Parameters:
key -
Returns:
the cached object or null
Throws:
CacheException

read

public Object read(Object key)
            throws CacheException
Specified by:
read in interface Cache
Throws:
CacheException

update

public void update(Object key,
                   Object value)
            throws CacheException
Add an item to the cache

Specified by:
update in interface Cache
Parameters:
key -
value -
Throws:
CacheException

put

public void put(Object key,
                Object value)
         throws CacheException
Add an item to the cache

Specified by:
put in interface Cache
Parameters:
key -
value -
Throws:
CacheException

remove

public void remove(Object key)
            throws CacheException
Remove an item from the cache

Specified by:
remove in interface Cache
Throws:
CacheException

clear

public void clear()
           throws CacheException
Clear the cache

Specified by:
clear in interface Cache
Throws:
CacheException

destroy

public void destroy()
             throws CacheException
Clean up

Specified by:
destroy in interface Cache
Throws:
CacheException

lock

public void lock(Object key)
          throws CacheException
If this is a clustered cache, lock the item

Specified by:
lock in interface Cache
Throws:
CacheException

unlock

public void unlock(Object key)
            throws CacheException
If this is a clustered cache, unlock the item

Specified by:
unlock in interface Cache
Throws:
CacheException

nextTimestamp

public long nextTimestamp()
Generate a (coarse) timestamp

Specified by:
nextTimestamp in interface Cache

getTimeout

public int getTimeout()
Get a reasonable "lock timeout"

Specified by:
getTimeout in interface Cache

getRegionName

public String getRegionName()
Specified by:
getRegionName in interface Cache

getSizeInMemory

public long getSizeInMemory()
Specified by:
getSizeInMemory in interface Cache

getElementCountInMemory

public long getElementCountInMemory()
Specified by:
getElementCountInMemory in interface Cache

getElementCountOnDisk

public long getElementCountOnDisk()
Specified by:
getElementCountOnDisk in interface Cache

toMap

public Map toMap()
Specified by:
toMap in interface Cache

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011 Hibernate.org. All Rights Reserved.