com.trackstudio.tools.cache
Class QueryCachedSwarmCache

java.lang.Object
  extended by com.trackstudio.tools.cache.QueryCachedSwarmCache
All Implemented Interfaces:
org.hibernate.cache.Cache

public class QueryCachedSwarmCache
extends java.lang.Object
implements org.hibernate.cache.Cache

Author:
Jason Carreira, Gavin King

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

Constructor Detail

QueryCachedSwarmCache

public QueryCachedSwarmCache(ObjectCache cache,
                             java.lang.String regionName)
Method Detail

get

public java.lang.Object get(java.lang.Object key)
                     throws org.hibernate.cache.CacheException
Get an item from the cache

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

update

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

put

public void put(java.lang.Object key,
                java.lang.Object value)
         throws org.hibernate.cache.CacheException
Add an item to the cache

Specified by:
put in interface org.hibernate.cache.Cache
Parameters:
key -
value -
Throws:
org.hibernate.cache.CacheException

remove

public void remove(java.lang.Object key)
            throws org.hibernate.cache.CacheException
Remove an item from the cache

Specified by:
remove in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

clear

public void clear()
           throws org.hibernate.cache.CacheException
Clear the cache

Specified by:
clear in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

destroy

public void destroy()
             throws org.hibernate.cache.CacheException
Clean up

Specified by:
destroy in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

lock

public void lock(java.lang.Object key)
          throws org.hibernate.cache.CacheException
If this is a clustered cache, lock the item

Specified by:
lock in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

unlock

public void unlock(java.lang.Object key)
            throws org.hibernate.cache.CacheException
If this is a clustered cache, unlock the item

Specified by:
unlock in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

nextTimestamp

public long nextTimestamp()
Generate a (coarse) timestamp

Specified by:
nextTimestamp in interface org.hibernate.cache.Cache

read

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

getTimeout

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

Specified by:
getTimeout in interface org.hibernate.cache.Cache

getRegionName

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

getSizeInMemory

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

getElementCountInMemory

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

getElementCountOnDisk

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

toMap

public java.util.Map toMap()
Specified by:
toMap in interface org.hibernate.cache.Cache


Copyright © 2002-2008 TrackStudio, Ltd. All Rights Reserved.