K - the type of keys for caching objects by this component.V - the type of objects cached by this component.public class CachingComponent<K,V> extends AbstractLogEnabled implements Initializable, Disposable
| Modifier and Type | Field and Description |
|---|---|
private Map<K,V> |
_objects |
private Timer |
_timer |
| Constructor and Description |
|---|
CachingComponent() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addObjectInCache(K key,
V object)
Adds a key/object pair in the cache.
|
protected void |
clearCache()
Removes all entries from the cache.
|
void |
dispose() |
protected V |
getObjectFromCache(K key)
Returns an object from the cache, correspondong to the specified key, or null if none.
|
void |
initialize() |
protected boolean |
isCacheEnabled()
Returns true if the cache is enabled.
|
protected void |
removeObjectFromCache(K key)
Removes a key/object pair in the cache.
|
getLogger, setLoggerpublic CachingComponent()
public void initialize() throws Exception
initialize in interface InitializableExceptionpublic void dispose()
dispose in interface Disposableprotected V getObjectFromCache(K key)
key - the object's key.protected void addObjectInCache(K key, V object)
key - the object's key.object - the object to be cached.protected void removeObjectFromCache(K key)
key - the object's key.protected void clearCache()
protected boolean isCacheEnabled()