net.spy.cache
Class LRUCache
java.lang.Object
net.spy.SpyObject
net.spy.cache.LRUCache
- public class LRUCache
- extends SpyObject
A fixed-size least-recently-used cache.
|
Constructor Summary |
LRUCache(int size)
Get an instance of LRUCache. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LRUCache
public LRUCache(int size)
- Get an instance of LRUCache.
get
public Object get(Object key)
- Get the named object from the cache.
- Parameters:
key - the key
- Returns:
- the value, or null if this mapping is not in the cache
put
public void put(Object key,
Object value)
- Store an object in the cache. This may cause an object to be
removed from the cache to make room.
- Parameters:
key - the cache keyvalue - the cache value