net.spy.cache
Class LRUCache<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
net.spy.cache.LRUCache<K,V>
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.util.Map<K,V>
public class LRUCache<K,V>
- extends java.util.LinkedHashMap<K,V>
A fixed-size least-recently-used cache.
- See Also:
- Serialized Form
|
Constructor Summary |
LRUCache(int size)
Get an instance of LRUCache. |
|
Method Summary |
V |
get(java.lang.Object o)
Get the object from the cache, and defereference it if it's a reference. |
V |
put(K key,
V val)
|
protected boolean |
removeEldestEntry(java.util.Map.Entry<K,V> e)
|
| Methods inherited from class java.util.LinkedHashMap |
clear, containsValue |
| Methods inherited from class java.util.HashMap |
clone, containsKey, entrySet, isEmpty, keySet, putAll, remove, size, values |
| Methods inherited from class java.util.AbstractMap |
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
containsKey, entrySet, equals, hashCode, isEmpty, keySet, putAll, remove, size, values |
LRUCache
public LRUCache(int size)
- Get an instance of LRUCache.
get
public V get(java.lang.Object o)
- Get the object from the cache, and defereference it if it's a reference.
- Specified by:
get in interface java.util.Map<K,V>- Overrides:
get in class java.util.LinkedHashMap<K,V>
put
public V put(K key,
V val)
- Specified by:
put in interface java.util.Map<K,V>- Overrides:
put in class java.util.HashMap<K,V>
removeEldestEntry
protected boolean removeEldestEntry(java.util.Map.Entry<K,V> e)
- Overrides:
removeEldestEntry in class java.util.LinkedHashMap<K,V>
Copyright © 1995-2006 SPY Internetworking. All Rights Reserved.