T
- the type of objects cached by this component.public class CachingComponent<T> extends AbstractLogEnabled implements Initializable, Disposable
Modifier and Type | Field and Description |
---|---|
private Map<String,T> |
_objects |
private Timer |
_timer |
Constructor and Description |
---|
CachingComponent() |
Modifier and Type | Method and Description |
---|---|
protected void |
addObjectInCache(String key,
T object)
Adds a key/object pair in the cache.
|
protected void |
clearCache()
Removes all entries from the cache.
|
void |
dispose() |
protected T |
getObjectFromCache(String 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(String key)
Removes a key/object pair in the cache.
|
getLogger, setLogger
public CachingComponent()
public void initialize() throws Exception
initialize
in interface Initializable
Exception
public void dispose()
dispose
in interface Disposable
protected T getObjectFromCache(String key)
key
- the object's key.protected void addObjectInCache(String key, T object)
key
- the object's key.object
- the object to be cached.protected void removeObjectFromCache(String key)
key
- the object's key.protected void clearCache()
protected boolean isCacheEnabled()