org.apache.jackrabbit.mk.util
Class SimpleLRUCache<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
org.apache.jackrabbit.mk.util.SimpleLRUCache<K,V>
- Type Parameters:
K - the keyV - the value
- All Implemented Interfaces:
- Serializable, Cloneable, Map<K,V>
public class SimpleLRUCache<K,V>
- extends LinkedHashMap<K,V>
This class implements a small LRU object cache.
- See Also:
- Serialized Form
| Methods inherited from interface java.util.Map |
containsKey, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
newInstance
public static <K,V> SimpleLRUCache<K,V> newInstance(int size)
- Create a new object with all elements of the given collection.
- Type Parameters:
K - the key typeV - the value type- Parameters:
size - the number of elements
- Returns:
- the object
setMaxSize
public void setMaxSize(int size)
removeEldestEntry
protected boolean removeEldestEntry(Map.Entry<K,V> eldest)
- Overrides:
removeEldestEntry in class LinkedHashMap<K,V>
Copyright © 2012 The Apache Software Foundation. All Rights Reserved.