| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.swarmcache.TimerCache
public class 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.util.Set | 
getAllKeys()
Get all items.  | 
 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 ObjectCachepublic 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 ObjectCachepublic java.lang.Object get(java.io.Serializable key)
ObjectCache
get in interface ObjectCachepublic java.lang.Object clear(java.io.Serializable key)
ObjectCache
clear in interface ObjectCachepublic void clearAll()
ObjectCache
clearAll in interface ObjectCachepublic void run()
run in interface java.lang.Runnablepublic java.util.Set getAllKeys()
ObjectCache
getAllKeys in interface ObjectCache
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||