org.apache.camel.util
Class LRUCache<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
org.apache.camel.util.LRUCache<K,V>
- All Implemented Interfaces:
- Serializable, Cloneable, Map<K,V>
public class LRUCache<K,V>
- extends LinkedHashMap<K,V>
A Least Recently Used Cache
- Version:
- $Revision: 655284 $
- See Also:
- Serialized Form
Constructor Summary |
LRUCache(int maximumCacheSize)
|
LRUCache(int initialCapacity,
int maximumCacheSize,
float loadFactor,
boolean accessOrder)
Constructs an empty LRUCache instance with the
specified initial capacity, maximumCacheSize,load factor and ordering mode. |
Methods inherited from interface java.util.Map |
containsKey, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
LRUCache
public LRUCache(int maximumCacheSize)
LRUCache
public LRUCache(int initialCapacity,
int maximumCacheSize,
float loadFactor,
boolean accessOrder)
- Constructs an empty LRUCache instance with the
specified initial capacity, maximumCacheSize,load factor and ordering mode.
- Parameters:
initialCapacity
- the initial capacity.maximumCacheSize
- loadFactor
- the load factor.accessOrder
- the ordering mode - true for
access-order, false for insertion-order.
- Throws:
IllegalArgumentException
- if the initial capacity is negative
or the load factor is non positive.
getMaxCacheSize
public int getMaxCacheSize()
- Returns the maxCacheSize.
removeEldestEntry
protected boolean removeEldestEntry(Map.Entry entry)
- Overrides:
removeEldestEntry
in class LinkedHashMap<K,V>
Copyright © 2009 Apache Software Foundation. All Rights Reserved.