org.shiftone.cache.decorator.jmx
Class JmxCache

java.lang.Object
  extended byorg.shiftone.cache.decorator.jmx.JmxCache
All Implemented Interfaces:
Cache, JmxCacheMBean

public class JmxCache
extends java.lang.Object
implements JmxCacheMBean, Cache


Constructor Summary
JmxCache(java.lang.String name, Cache cache)
           
 
Method Summary
 void addObject(java.lang.Object key, java.lang.Object cacheObject)
          adds an object to the cache
 void clear()
          Removes ALL keys and values from the cache.
 void clearCache()
          clear the cache
 void clearStatistics()
          clear the stats
 long getAddCount()
          the total number of calls to addObject()
 java.lang.String getCacheName()
          the name of this cache
 long getClearCount()
          the total number of calls to clear()
 long getGetCount()
          the total number of calls to getObject() - total of hit count and miss count.
 long getHitCount()
          the total number of calls to getObject() that resulted in a non-null value
 double getHitRatio()
          hits / gets
 long getMissCount()
          the total number of calls to getObject() that resulted in a null value
 java.lang.Object getObject(java.lang.Object key)
          gets the value stored in the cache by it's key, or null if the key is not found.
 long getRemoveCount()
          the total number of calls to remove()
 int getSize()
          the current number of keys in the cache
 java.lang.String getToString()
          the value of toString()
 void remove(java.lang.Object key)
          remove a specific key/value pair from the cache
 int size()
          The number of key/value pares in the cache
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JmxCache

public JmxCache(java.lang.String name,
                Cache cache)
Method Detail

getCacheName

public java.lang.String getCacheName()
Description copied from interface: JmxCacheMBean
the name of this cache

Specified by:
getCacheName in interface JmxCacheMBean

getToString

public java.lang.String getToString()
Description copied from interface: JmxCacheMBean
the value of toString()

Specified by:
getToString in interface JmxCacheMBean

getSize

public int getSize()
Description copied from interface: JmxCacheMBean
the current number of keys in the cache

Specified by:
getSize in interface JmxCacheMBean

clearCache

public void clearCache()
Description copied from interface: JmxCacheMBean
clear the cache

Specified by:
clearCache in interface JmxCacheMBean

getGetCount

public long getGetCount()
Description copied from interface: JmxCacheMBean
the total number of calls to getObject() - total of hit count and miss count.

Specified by:
getGetCount in interface JmxCacheMBean

getAddCount

public long getAddCount()
Description copied from interface: JmxCacheMBean
the total number of calls to addObject()

Specified by:
getAddCount in interface JmxCacheMBean

getRemoveCount

public long getRemoveCount()
Description copied from interface: JmxCacheMBean
the total number of calls to remove()

Specified by:
getRemoveCount in interface JmxCacheMBean

getClearCount

public long getClearCount()
Description copied from interface: JmxCacheMBean
the total number of calls to clear()

Specified by:
getClearCount in interface JmxCacheMBean

getHitCount

public long getHitCount()
Description copied from interface: JmxCacheMBean
the total number of calls to getObject() that resulted in a non-null value

Specified by:
getHitCount in interface JmxCacheMBean

getMissCount

public long getMissCount()
Description copied from interface: JmxCacheMBean
the total number of calls to getObject() that resulted in a null value

Specified by:
getMissCount in interface JmxCacheMBean

getHitRatio

public double getHitRatio()
Description copied from interface: JmxCacheMBean
hits / gets

Specified by:
getHitRatio in interface JmxCacheMBean

clearStatistics

public void clearStatistics()
Description copied from interface: JmxCacheMBean
clear the stats

Specified by:
clearStatistics in interface JmxCacheMBean

addObject

public void addObject(java.lang.Object key,
                      java.lang.Object cacheObject)
Description copied from interface: Cache
adds an object to the cache

Specified by:
addObject in interface Cache

getObject

public java.lang.Object getObject(java.lang.Object key)
Description copied from interface: Cache
gets the value stored in the cache by it's key, or null if the key is not found.

Specified by:
getObject in interface Cache

size

public int size()
Description copied from interface: Cache
The number of key/value pares in the cache

Specified by:
size in interface Cache

remove

public void remove(java.lang.Object key)
Description copied from interface: Cache
remove a specific key/value pair from the cache

Specified by:
remove in interface Cache

clear

public void clear()
Description copied from interface: Cache
Removes ALL keys and values from the cache. Use with digression. Using this method too frequently may defeat the purpose of caching.

Specified by:
clear in interface Cache

toString

public java.lang.String toString()