public class TimerCache extends java.lang.Object implements ObjectCache, java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
TimerCache() |
Modifier and Type | Method and Description |
---|---|
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.
|
public static final java.lang.String CACHE_TIMEOUT_PROPERTY
public static final int DEFAULT_CACHE_TIMEOUT
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