|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.keel.services.cache.excalibur.ConfigurableCache
Configurable Cache Component. An extended version of the TimeMapLRUCache implementation from Excalibur that adds configuration capabilities.
| Field Summary | |
private Logger |
log |
private TimeMapLRUCache |
myCache |
| Fields inherited from interface org.keel.services.cache.Cache |
ROLE |
| Constructor Summary | |
ConfigurableCache()A no-op constructor. |
|
ConfigurableCache(Logger log, int cacheSize)A constructor that accepts all dependencies and configuration as arguments. |
|
| Method Summary | |
void |
addListener(CacheListener listener) |
void |
addObject(java.lang.String key, java.lang.Object value)Adds an object to the cache. |
int |
capacity() |
void |
clear() |
void |
configure(Configuration configuration)Pass the Configuration to the Configurable class. |
void |
enableLogging(Logger logger)Provide component with a logger. |
void |
flushCache()Flush the cache of all objects. |
java.lang.Object |
get(java.lang.Object key) |
int |
getCacheSize()Returns the current size of the cache. |
int |
getNumberOfObjects()Returns the number of objects in the cache. |
java.lang.Object |
getObject(java.lang.String key)Gets a cached object given its id (a String). |
java.lang.Object |
put(java.lang.Object key, java.lang.Object value) |
void |
removeListener(CacheListener listener) |
void |
removeObject(java.lang.String s)Removes an object from the cache. |
void |
setCacheSize(int cacheSize)Set the desired size of the backing cache. |
void |
setLog(Logger log)Set the logger to use for debugging. |
int |
size() |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private Logger log
private TimeMapLRUCache myCache
| Constructor Detail |
public ConfigurableCache()
public ConfigurableCache(Logger log,
int cacheSize)
log - the logger we'll use for debugging.cacheSize - the desired size of the backing cache.| Method Detail |
public void setLog(Logger log)
log - the logger to use for debugging.public void setCacheSize(int cacheSize)
cacheSize - the desired size of the backing cache.
public void configure(Configuration configuration)
throws ConfigurationException
ConfigurableConfiguration to the Configurable class.
configure in interface Configurableconfiguration - the class configurations. Must not be null.ConfigurationException - if an error occursConfigurable.configure(Configuration)public void enableLogging(Logger logger)
LogEnabledenableLogging in interface LogEnabledlogger - the logger. Must not be null.LogEnabled.enableLogging(Logger)public void removeObject(java.lang.String s)
CacheremoveObject in interface Caches - The String id for the object.public int getNumberOfObjects()
CachegetNumberOfObjects in interface Cachepublic int capacity()
public void removeListener(CacheListener listener)
public int size()
public void addListener(CacheListener listener)
public void clear()
public void flushCache()
CacheflushCache in interface Cachepublic int getCacheSize()
CachegetCacheSize in interface Cachepublic java.lang.Object getObject(java.lang.String key)
CachegetObject in interface Cachekey - The String id for the object.public java.lang.Object get(java.lang.Object key)
public void addObject(java.lang.String key,
java.lang.Object value)
CacheaddObject in interface Cachekey - The String id for the object.value - The object to add to the cache.
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||