|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.TimerTask | +--solar.module.cache.BaseCache
A base implementation of cache interface. Once an object is cached, it cannot be refreshed which means it will be stale at pre-determined expiration time.
Nested Class Summary |
Nested classes inherited from class solar.module.cache.Cache |
Cache.CacheListener |
Field Summary | |
protected java.util.Hashtable |
_cache
|
protected int |
_capacity
|
protected java.util.List |
_listeners
|
protected int |
_size
|
protected long |
_ttl
|
Fields inherited from class java.util.TimerTask |
|
Fields inherited from interface solar.module.cache.CacheConstants |
CACHE_CAPACITY_DEFAULT, CACHE_CAPACITY_INFINIT, CACHE_TTL_DEFAULT, CACHE_TTL_FOREVER |
Constructor Summary | |
BaseCache()
|
|
BaseCache(int capacity,
long ttl)
|
Method Summary | |
void |
addListener(Cache.CacheListener lis)
Add a listener to the cache. |
void |
addObject(java.lang.Object objectId,
java.lang.Object obj)
If the objectId already exists in the cache, this add operation does override the previous cached object with the one supplied in parameter. |
void |
flush()
Flush all the objects in the cache. |
CachedObject |
getCachedObject(java.lang.Object objectId)
Get the container for an object from the cache. |
java.util.List |
getCachedObjects()
Get the list of the cached objects from the cache. |
int |
getCapacity()
Get the capacity of the cache. |
java.lang.Object |
getObject(java.lang.Object objectId)
Get an object from the cache. |
java.util.List |
getObjectIds()
Get the list of the object ids from the cache. |
java.util.List |
getObjects()
Get the list of the objects from the cache. |
int |
getSize()
Get the number of objects in the cache. |
private void |
notifyObjectExpired(CachedObject co)
|
void |
removeListener(Cache.CacheListener lis)
Remove a listener from the cache. |
void |
removeObject(java.lang.Object objectId)
Remove an object from a cache. |
void |
run()
|
Methods inherited from class java.util.TimerTask |
cancel, scheduledExecutionTime |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int _capacity
protected long _ttl
protected int _size
protected java.util.List _listeners
protected java.util.Hashtable _cache
Constructor Detail |
public BaseCache()
public BaseCache(int capacity, long ttl)
Method Detail |
public void addListener(Cache.CacheListener lis)
Cache
addListener
in interface Cache
public void removeListener(Cache.CacheListener lis)
Cache
removeListener
in interface Cache
public void addObject(java.lang.Object objectId, java.lang.Object obj) throws CacheException
addObject
in interface Cache
CacheException
public java.lang.Object getObject(java.lang.Object objectId)
Cache
getObject
in interface Cache
public CachedObject getCachedObject(java.lang.Object objectId)
Cache
getCachedObject
in interface Cache
public java.util.List getObjects()
Cache
getObjects
in interface Cache
public java.util.List getCachedObjects()
Cache
getCachedObjects
in interface Cache
public java.util.List getObjectIds()
Cache
getObjectIds
in interface Cache
public void removeObject(java.lang.Object objectId)
Cache
removeObject
in interface Cache
public int getCapacity()
Cache
getCapacity
in interface Cache
public int getSize()
Cache
getSize
in interface Cache
public void flush()
Cache
flush
in interface Cache
public void run()
run
in interface java.lang.Runnable
run
in class java.util.TimerTask
private void notifyObjectExpired(CachedObject co)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |