org.apache.activemq.util
Class LRUCache

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by java.util.LinkedHashMap
              extended by org.apache.activemq.util.LRUCache
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map

public class LRUCache
extends java.util.LinkedHashMap

A Simple LRU Cache

Version:
$Revision$
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Field Summary
protected  int maxCacheSize
           
 
Constructor Summary
LRUCache()
          Constructs LRU Cache
 
Method Summary
 int getMaxCacheSize()
           
protected  boolean removeEldestEntry(java.util.Map.Entry entry)
           
 void setMaxCacheSize(int maxCacheSize)
           
 
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

maxCacheSize

protected int maxCacheSize
Constructor Detail

LRUCache

public LRUCache()
Constructs LRU Cache

Method Detail

getMaxCacheSize

public int getMaxCacheSize()
Returns:
Returns the maxCacheSize.

setMaxCacheSize

public void setMaxCacheSize(int maxCacheSize)
Parameters:
maxCacheSize - The maxCacheSize to set.

removeEldestEntry

protected boolean removeEldestEntry(java.util.Map.Entry entry)
Overrides:
removeEldestEntry in class java.util.LinkedHashMap


Copyright © 2011 Apache Software Foundation. All Rights Reserved.