|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.caucho.util.LruCache
Fixed length cache with a LRU replacement policy. If cache items implement CacheListener, they will be informed when they're removed from the cache.
Null keys are not allowed. LruCache is synchronized.
Constructor Summary | |
LruCache(int initialCapacity)
Create the LRU cache with a specific capacity. |
Method Summary | |
void |
clear()
Clears the cache |
java.lang.Object |
get(java.lang.Object key)
Get an item from the cache and make it most recently used. |
java.util.Iterator |
keys()
Returns the keys stored in the cache |
java.util.Iterator |
keys(java.util.Iterator oldIter)
Returns keys stored in the cache using an old iterator |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Puts a new item in the cache. |
java.lang.Object |
remove(java.lang.Object key)
Removes an item from the cache |
boolean |
removeTail()
Remove the last item in the LRU |
java.util.Iterator |
values()
Returns the values in the cache |
java.util.Iterator |
values(java.util.Iterator oldIter)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LruCache(int initialCapacity)
initialCapacity
- minimum capacity of the cacheMethod Detail |
public void clear()
public java.lang.Object get(java.lang.Object key)
key
- key to lookup the itempublic java.lang.Object put(java.lang.Object key, java.lang.Object value)
key
- key to store datavalue
- value to be storedpublic boolean removeTail()
public java.lang.Object remove(java.lang.Object key)
key
- the key to removepublic java.util.Iterator keys()
public java.util.Iterator keys(java.util.Iterator oldIter)
public java.util.Iterator values()
public java.util.Iterator values(java.util.Iterator oldIter)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |