org.globus.wsrf.utils.cache
Class LRUCache
java.lang.Object
org.globus.wsrf.utils.cache.LRUCache
- All Implemented Interfaces:
- Cache, Initializable, commonj.timers.TimerListener
- public class LRUCache
- extends java.lang.Object
- implements Initializable, commonj.timers.TimerListener, Cache
LRU cache implementation. The most recently used move to the end of the
list while the least recently used stay at the beginning of the list.
The least recently used (within a timeout period) are removed periodically.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_TIMEOUT
private static final int DEFAULT_TIMEOUT
- See Also:
- Constant Field Values
DEFAULT_DELAY
private static final int DEFAULT_DELAY
- See Also:
- Constant Field Values
logger
private static org.apache.commons.logging.Log logger
cache
private java.util.Map cache
list
private LinkedNodeList list
timerManager
private commonj.timers.TimerManager timerManager
timer
private commonj.timers.Timer timer
timeout
private long timeout
delay
private long delay
initialized
private boolean initialized
LRUCache
public LRUCache()
setTimeout
public void setTimeout(long timeout)
getTimeout
public long getTimeout()
setDelay
public void setDelay(long delay)
getDelay
public long getDelay()
initialize
public void initialize()
throws java.lang.Exception
- Specified by:
initialize in interface Initializable
- Throws:
java.lang.Exception
resetTimer
private void resetTimer()
scheduleTimer
private void scheduleTimer()
update
public void update(java.lang.Object resource)
- Specified by:
update in interface Cache
remove
public void remove(java.lang.Object resource)
- Specified by:
remove in interface Cache
clear
public void clear()
- Specified by:
clear in interface Cache
getSize
public int getSize()
- Specified by:
getSize in interface Cache
cleanExpired
public void cleanExpired()
timerExpired
public void timerExpired(commonj.timers.Timer timer)
- Specified by:
timerExpired in interface commonj.timers.TimerListener