com.caucho.util
Class LongKeyHashMap<E>

java.lang.Object
  extended by com.caucho.util.LongKeyHashMap<E>

public class LongKeyHashMap<E>
extends java.lang.Object

Cache with a clock replacement policy.

Null keys are not allowed. LruCache is synchronized.


Constructor Summary
LongKeyHashMap()
          Create the clock cache with a specific capacity.
LongKeyHashMap(int initialCapacity)
          Create the clock cache with a specific capacity.
 
Method Summary
 void clear()
          Clears the map
 E get(long key)
          Get an item from the cache and make it most recently used.
 E put(long key, E value)
          Puts a new item in the cache.
 E remove(long key)
          Removes an item from the map
 int size()
          Returns the current number of entries in the cache.
 java.util.Iterator<E> valueIterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LongKeyHashMap

public LongKeyHashMap()
Create the clock cache with a specific capacity.

Parameters:
initialCapacity - minimum capacity of the cache

LongKeyHashMap

public LongKeyHashMap(int initialCapacity)
Create the clock cache with a specific capacity.

Parameters:
initialCapacity - minimum capacity of the cache
Method Detail

size

public int size()
Returns the current number of entries in the cache.


clear

public void clear()
Clears the map


get

public E get(long key)
Get an item from the cache and make it most recently used.

Parameters:
key - key to lookup the item
Returns:
the matching object in the cache

put

public E put(long key,
             E value)
Puts a new item in the cache. If the cache is full, remove the LRU item.

Parameters:
key - key to store data
value - value to be stored
Returns:
old value stored under the key

remove

public E remove(long key)
Removes an item from the map

Parameters:
key - the key to remove
Returns:
the value removed

valueIterator

public java.util.Iterator<E> valueIterator()