|
iiitToolkit 1.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.iiit.cache.GenericCache | +--de.iiit.cache.GenericTimeoutCache
A cache with background clean-up thread which removes all entries not used for a given period of time.
Constructor Summary | |
GenericTimeoutCache()
Creates a new instance of GenericTimeoutCache |
|
GenericTimeoutCache(long timeout)
Creates a new instance of GenericTimeoutCache |
|
GenericTimeoutCache(long timeout,
long sleeptime)
Creates a new instance of GenericTimeoutCache |
Method Summary | |
void |
addElement(Object key,
Object value)
Add a new element to the cache. |
Object |
getElement(Object key)
Retrieves an cache-entry. |
protected long |
getElementTimeout(Object key)
Retrieves the timeout of the cache element. |
void |
shutdown()
Stop the cleaner thread |
Methods inherited from class de.iiit.cache.GenericCache |
clear, getKeys, removeElement, size |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public GenericTimeoutCache()
public GenericTimeoutCache(long timeout)
timeout
- The period of time after which unused entries shall be removed automaticallypublic GenericTimeoutCache(long timeout, long sleeptime)
timeout
- The period of time after which unused entries shall be removed automaticallysleeptime
- The amount of time the clean-up thread shall sleep between to runs.Method Detail |
public void shutdown()
public void addElement(Object key, Object value)
addElement
in class GenericCache
key
- The unique key of the cache entryvalue
- The value of the cache entrypublic Object getElement(Object key) throws CacheFaultException
getElement
in class GenericCache
key
- The unique key of the cache entry to retrieve
CacheFaultException
- if there is no entry with the given keyprotected long getElementTimeout(Object key)
key
- The unique key of the cache entry to retrieve
|
iiitToolkit 1.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |