|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sf.swarmcache.TimerCache
Cache implementation that times out cached elements. Each item put in the cache is timed out after a specified number of milliseconds (unless removed before the timeout).
Field Summary | |
static java.lang.String |
CACHE_TIMEOUT_PROPERTY
The property containing the cache timeout (in milliseconds). |
static int |
DEFAULT_CACHE_TIMEOUT
The default cache timeout (1 minute). |
Constructor Summary | |
TimerCache()
|
Method Summary | |
java.lang.Object |
clear(java.io.Serializable key)
Clears an object from the cache by key. |
void |
clearAll()
Clears the entire cache. |
java.lang.Object |
get(java.io.Serializable key)
Gets an object from the cache by key, or returns null if that object is not cached. |
java.lang.String |
getType()
Gets the cache type name. |
void |
put(java.io.Serializable key,
java.lang.Object object)
Caches an object. |
void |
run()
|
void |
setTimeout(long newTimeout)
Sets a new timeout value-- only do this before using the cache! |
void |
setType(java.lang.String type)
Sets the cache type name. |
void |
stop()
Called to stop the timer thread. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String CACHE_TIMEOUT_PROPERTY
public static final int DEFAULT_CACHE_TIMEOUT
Constructor Detail |
public TimerCache()
Method Detail |
public void setTimeout(long newTimeout)
public void stop()
public java.lang.String getType()
getType
in interface ObjectCache
public void setType(java.lang.String type)
setType
in interface ObjectCache
public void put(java.io.Serializable key, java.lang.Object object)
null
, then any object cached at the given key is removed from the cache.
put
in interface ObjectCache
public java.lang.Object get(java.io.Serializable key)
ObjectCache
get
in interface ObjectCache
public java.lang.Object clear(java.io.Serializable key)
ObjectCache
clear
in interface ObjectCache
public void clearAll()
ObjectCache
clearAll
in interface ObjectCache
public void run()
run
in interface java.lang.Runnable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |