| java.lang.Object com.whirlycott.cache.CacheDecorator
CacheDecorator | public class CacheDecorator implements Runnable,Cache<K, V>,CacheDecoratorMBean(Code) | | Owns the cache tuning thread and provides housekeeping facilities for ManagedCache implementations. One
CacheDecorator is created for each Cache named in the whirlycache.xml configuration file.
author: Phil Jacob |
Method Summary | |
public void | clear() Clears the cache. | protected void | configure(CacheConfiguration configuration) Configures the Cache being decorated. | public void | dispose() Shut down this cache. | protected void | doAdaptiveAccounting(int _value) Looks at the last 'n' queries to determine whether the Cache should turn on optimizations for a mostly-read
environment (if the underlying implementation of ManagedCache supports this). | protected void | expireItems() Expires Items in need of expiration. | protected int | getAdaptiveMemorySize() | public float | getAdaptiveRatio() Calculates the adaptive hit rate for this cache. | public String | getEfficiencyReport() Returns an efficiency report string for this cache. | protected int | getMaxSize() Get the maximum size of the cache. | protected CacheMaintenancePolicy | getPolicy() | public long | getQueriesPerSecond() | public int | getSize() | public float | getTotalHitrate() Returns the total hitrate since this Cache was started. | protected V | internalRemove(K _key) An internal remove operation. | protected V | internalRetrieve(K _key) | protected void | internalStore(K _key, V _value, long _expiresAfter) All stores go through this. | protected void | logStatistics() Log some cache usage data depending on some conditions. | public V | remove(K _key) Removes an Object from the Cache and returns the removed Object. | public V | retrieve(K _key) Gets an Object from the Cache. | public void | run() | public int | size() Returns the number of items in the Cache. | public void | store(K _key, V _value) Store an object in the cache. | public void | store(K _key, V _value, long _expiresAfter) |
clear | public void clear()(Code) | | Clears the cache.
|
dispose | public void dispose()(Code) | | Shut down this cache.
|
doAdaptiveAccounting | protected void doAdaptiveAccounting(int _value)(Code) | | Looks at the last 'n' queries to determine whether the Cache should turn on optimizations for a mostly-read
environment (if the underlying implementation of ManagedCache supports this).
Parameters: _value - varies depending on whether this was a read, write, or removal. |
expireItems | protected void expireItems()(Code) | | Expires Items in need of expiration.
|
getAdaptiveMemorySize | protected int getAdaptiveMemorySize()(Code) | | Returns the adaptiveMemorySize. |
getAdaptiveRatio | public float getAdaptiveRatio()(Code) | | Calculates the adaptive hit rate for this cache.
adaptive hit ratio. |
getEfficiencyReport | public String getEfficiencyReport()(Code) | | Returns an efficiency report string for this cache.
efficiency report for this cache. |
getMaxSize | protected int getMaxSize()(Code) | | Get the maximum size of the cache.
Returns the maxSize. |
getQueriesPerSecond | public long getQueriesPerSecond()(Code) | | |
getSize | public int getSize()(Code) | | |
getTotalHitrate | public float getTotalHitrate()(Code) | | Returns the total hitrate since this Cache was started.
Total hitrate. |
internalRemove | protected V internalRemove(K _key)(Code) | | An internal remove operation.
Parameters: _key - removed item |
internalRetrieve | protected V internalRetrieve(K _key)(Code) | | |
internalStore | protected void internalStore(K _key, V _value, long _expiresAfter)(Code) | | All stores go through this.
Parameters: _key - Parameters: _value - Parameters: _expiresAfter - specified in milliseconds |
logStatistics | protected void logStatistics()(Code) | | Log some cache usage data depending on some conditions.
|
remove | public V remove(K _key)(Code) | | Removes an Object from the Cache and returns the removed Object.
Parameters: _key - key associated with object to remove. |
retrieve | public V retrieve(K _key)(Code) | | Gets an Object from the Cache.
|
size | public int size()(Code) | | Returns the number of items in the Cache.
number of items in the cache. |
store | public void store(K _key, V _value)(Code) | | Store an object in the cache.
|
store | public void store(K _key, V _value, long _expiresAfter)(Code) | | |
|
|