K - V - public class LRUCache<K,V>
extends java.util.LinkedHashMap<K,V>
| Modifier and Type | Field and Description |
|---|---|
protected int |
maxCacheSize |
| Constructor and Description |
|---|
LRUCache()
Default constructor for an LRU Cache The default capacity is 10000
|
LRUCache(int maximumCacheSize)
Constructs a LRUCache with a maximum capacity
|
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.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getMaxCacheSize() |
protected void |
onCacheEviction(java.util.Map.Entry<K,V> eldest) |
protected boolean |
removeEldestEntry(java.util.Map.Entry<K,V> eldest) |
void |
setMaxCacheSize(int maxCacheSize) |
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, valuespublic LRUCache()
public LRUCache(int maximumCacheSize)
maximumCacheSize - public LRUCache(int initialCapacity,
int maximumCacheSize,
float loadFactor,
boolean accessOrder)
initialCapacity - the initial capacity.maximumCacheSize - loadFactor - the load factor.accessOrder - the ordering mode - true for access-order,
false for insertion-order.java.lang.IllegalArgumentException - if the initial capacity is negative or
the load factor is non-positive.Copyright © 2005-2014 Red Hat, Inc.. All Rights Reserved.