org.activemq.util
Class LRUCache

java.lang.Object
  extended by java.util.AbstractMap
      extended by java.util.HashMap
          extended by java.util.LinkedHashMap
              extended by org.activemq.util.LRUCache
All Implemented Interfaces:
Serializable, Cloneable, Map

public class LRUCache
extends LinkedHashMap

Represnts an LRUCache of a fixed maximum size which by default will remove items based on access order but can be used to use insertion order

Version:
$Revision: 1.1.1.1 $
See Also:
Serialized Form

Field Summary
protected static int DEFAULT_INITIAL_CAPACITY
           
protected static float DEFAULT_LOAD_FACTOR
           
 
Constructor Summary
LRUCache(int maxSize)
           
LRUCache(int maxSize, boolean accessOrder)
           
LRUCache(int initialCapacity, float loadFactor, boolean accessOrder, int maxSize)
           
 
Method Summary
protected  boolean removeEldestEntry(Map.Entry eldest)
           
 
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, get
 
Methods inherited from class java.util.HashMap
clone, containsKey, entrySet, isEmpty, keySet, put, 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, put, putAll, remove, size, values
 

Field Detail

DEFAULT_INITIAL_CAPACITY

protected static final int DEFAULT_INITIAL_CAPACITY
See Also:
Constant Field Values

DEFAULT_LOAD_FACTOR

protected static final float DEFAULT_LOAD_FACTOR
See Also:
Constant Field Values
Constructor Detail

LRUCache

public LRUCache(int initialCapacity,
                float loadFactor,
                boolean accessOrder,
                int maxSize)

LRUCache

public LRUCache(int maxSize)

LRUCache

public LRUCache(int maxSize,
                boolean accessOrder)
Method Detail

removeEldestEntry

protected boolean removeEldestEntry(Map.Entry eldest)
Overrides:
removeEldestEntry in class LinkedHashMap


Copyright © 2004-2010 Protique, Ltd.. All Rights Reserved.