|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.caucho.util.LongKeyLruCache<V>
public class LongKeyLruCache<V>
Fixed length cache with a LRU replacement policy. If cache items implement CacheListener, they will be informed when they're removed from the cache.
LongKeyLruCache is synchronized.
| Constructor Summary | |
|---|---|
LongKeyLruCache(int initialCapacity)
Create the LRU cache with a specific capacity. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears the cache |
LongKeyLruCache<V> |
ensureCapacity(int newCapacity)
Ensure the cache can contain the given value. |
V |
get(long key)
Get an item from the cache and make it most recently used. |
int |
getCapacity()
Returns the capacity. |
long |
getHitCount()
Returns the hit count. |
long |
getMissCount()
Returns the miss count. |
V |
put(long key,
V value)
Puts a new item in the cache. |
V |
putIfAbsent(long key,
V value)
Puts a new item in the cache. |
V |
putIfNew(long key,
V value)
Puts a new item in the cache. |
V |
remove(long key)
Removes an item from the cache |
boolean |
removeTail()
Remove the last item in the LRU |
LongKeyLruCache<V> |
setCapacity(int newCapacity)
|
int |
size()
Returns the current number of entries in the cache. |
java.util.Iterator<V> |
values()
Returns the values in the cache |
java.util.Iterator<V> |
values(java.util.Iterator<V> oldIter)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LongKeyLruCache(int initialCapacity)
initialCapacity - minimum capacity of the cache| Method Detail |
|---|
public int size()
public int getCapacity()
public LongKeyLruCache<V> ensureCapacity(int newCapacity)
public LongKeyLruCache<V> setCapacity(int newCapacity)
public void clear()
public V get(long key)
key - key to lookup the item
public V put(long key,
V value)
key - key to store datavalue - value to be stored
public V putIfNew(long key,
V value)
key - key to store datavalue - value to be stored
public V putIfAbsent(long key,
V value)
key - key to store datavalue - value to be stored
public boolean removeTail()
public V remove(long key)
key - the key to remove
public java.util.Iterator<V> values()
public java.util.Iterator<V> values(java.util.Iterator<V> oldIter)
public long getHitCount()
public long getMissCount()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||