net.sf.swan.util
Class LRUCache
java.lang.Object
|
+--net.sf.swan.util.LRUCache
- All Implemented Interfaces:
- Cache
- public class LRUCache
- extends java.lang.Object
- implements Cache
A cache that uses a Least Recently Used algorithm for expiring
resources from the cache. When the configured capacity is exceeded,
the cache makes the least recently used items available for garbage collection.
Those items are removed from the cache as they are garbage collected.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LRUCache
public LRUCache()
getCapacity
public int getCapacity()
- Specified by:
getCapacity in interface Cache
setCapacity
public void setCapacity(int capacity)
- Specified by:
setCapacity in interface Cache
get
public java.lang.Object get(java.lang.Object key)
- Specified by:
get in interface Cache
put
public void put(java.lang.Object key,
java.lang.Object resource)
- Specified by:
put in interface Cache
remove
public void remove(java.lang.Object key)
- Specified by:
remove in interface Cache
clear
public void clear()
- Specified by:
clear in interface Cache
processQueue
protected void processQueue()
checkSize
protected void checkSize()