|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.camel.util.LRUCache<K,V>
public class LRUCache<K,V>
A Least Recently Used Cache.
If this cache storesService
then this implementation will on eviction
invoke the Service.stop()
method, to auto-stop the service.
LRUSoftCache
,
LRUWeakCache
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Constructor Summary | |
---|---|
LRUCache(int maximumCacheSize)
Constructs an empty LRUCache instance with the specified maximumCacheSize, and will stop on eviction. |
|
LRUCache(int initialCapacity,
int maximumCacheSize)
Constructs an empty LRUCache instance with the specified initial capacity, maximumCacheSize, and will stop on eviction. |
|
LRUCache(int initialCapacity,
int maximumCacheSize,
boolean stopOnEviction)
Constructs an empty LRUCache instance with the specified initial capacity, maximumCacheSize,load factor and ordering mode. |
Method Summary | |
---|---|
void |
clear()
|
boolean |
containsKey(Object o)
|
boolean |
containsValue(Object o)
|
Set<Map.Entry<K,V>> |
entrySet()
|
V |
get(Object o)
|
long |
getEvicted()
Gets the number of evicted entries. |
long |
getHits()
Gets the number of cache hits |
int |
getMaxCacheSize()
Returns the maxCacheSize. |
long |
getMisses()
Gets the number of cache misses. |
boolean |
isEmpty()
|
Set<K> |
keySet()
|
void |
onEviction(K key,
V value)
|
V |
put(K k,
V v)
|
void |
putAll(Map<? extends K,? extends V> map)
|
V |
remove(Object o)
|
void |
resetStatistics()
Rest the cache statistics such as hits and misses. |
int |
size()
|
String |
toString()
|
Collection<V> |
values()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode |
Constructor Detail |
---|
public LRUCache(int maximumCacheSize)
maximumCacheSize
- the max capacity.
IllegalArgumentException
- if the initial capacity is negativepublic LRUCache(int initialCapacity, int maximumCacheSize)
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.
IllegalArgumentException
- if the initial capacity is negativepublic LRUCache(int initialCapacity, int maximumCacheSize, boolean stopOnEviction)
initialCapacity
- the initial capacity.maximumCacheSize
- the max capacity.stopOnEviction
- whether to stop service on eviction.
IllegalArgumentException
- if the initial capacity is negativeMethod Detail |
---|
public V get(Object o)
get
in interface Map<K,V>
public int size()
size
in interface Map<K,V>
public boolean isEmpty()
isEmpty
in interface Map<K,V>
public boolean containsKey(Object o)
containsKey
in interface Map<K,V>
public boolean containsValue(Object o)
containsValue
in interface Map<K,V>
public V put(K k, V v)
put
in interface Map<K,V>
public V remove(Object o)
remove
in interface Map<K,V>
public void putAll(Map<? extends K,? extends V> map)
putAll
in interface Map<K,V>
public void clear()
clear
in interface Map<K,V>
public Set<K> keySet()
keySet
in interface Map<K,V>
public Collection<V> values()
values
in interface Map<K,V>
public Set<Map.Entry<K,V>> entrySet()
entrySet
in interface Map<K,V>
public void onEviction(K key, V value)
onEviction
in interface com.googlecode.concurrentlinkedhashmap.EvictionListener<K,V>
public long getHits()
public long getMisses()
public long getEvicted()
public int getMaxCacheSize()
public void resetStatistics()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |