Added another Constructor for convience that just takes the maximum number of cached items as a parameter

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@552726 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2007-07-03 08:21:00 +00:00
parent cbaa58b508
commit 791d78bc64
1 changed files with 11 additions and 1 deletions

View File

@ -23,6 +23,8 @@ import java.util.Map;
* A Simple LRU Cache
*
* @version $Revision$
* @param <K>
* @param <V>
*/
public class LRUCache<K, V> extends LinkedHashMap<K, V> {
@ -31,13 +33,21 @@ public class LRUCache<K, V> extends LinkedHashMap<K, V> {
/**
* Constructs LRU Cache
* Default constructorfor an LRU Cache
* The default capacity is 10000
*
*/
public LRUCache(){
super(1000,0.75f,true);
}
/**
* Constructs a LRUCache with a maximum capacity
* @param maximumCacheSize
*/
public LRUCache(int maximumCacheSize) {
this(maximumCacheSize,maximumCacheSize,0.75f,true);
}
/**
* Constructs an empty <tt>LRUCache</tt> instance with the
* specified initial capacity, maximumCacheSize,load factor and ordering mode.