public class ConcurrentLRUCache<K,V> extends Object
Note that the implementation does not follow a true LRU (least-recently-used) eviction strategy. Instead it strives to remove least recently used items but when the initial cleanup does not remove enough items to reach the 'acceptableWaterMark' limit, it can remove more items forcefully regardless of access order.
See org.apache.solr.util.ConcurrentLRUCacheModifier and Type | Class and Description |
---|---|
static interface |
ConcurrentLRUCache.EvictionListener<K,V> |
static class |
ConcurrentLRUCache.Stats |
Constructor and Description |
---|
ConcurrentLRUCache(int size,
int lowerWatermark) |
ConcurrentLRUCache(int upperWaterMark,
int lowerWaterMark,
int acceptableWatermark,
int initialSize,
boolean runCleanupThread,
boolean runNewThreadForCleanup,
ConcurrentLRUCache.EvictionListener<K,V> evictionListener) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
destroy() |
protected void |
finalize() |
V |
get(K key) |
Map<K,V> |
getLatestAccessedItems(int n) |
Map<Object,org.apache.myfaces.shared.util.ConcurrentLRUCache.CacheEntry<K,V>> |
getMap() |
Map<K,V> |
getOldestAccessedItems(int n)
Returns 'n' number of oldest accessed entries present in this cache.
|
ConcurrentLRUCache.Stats |
getStats() |
V |
put(K key,
V val) |
V |
remove(K key) |
void |
setAlive(boolean live) |
int |
size() |
public ConcurrentLRUCache(int upperWaterMark, int lowerWaterMark, int acceptableWatermark, int initialSize, boolean runCleanupThread, boolean runNewThreadForCleanup, ConcurrentLRUCache.EvictionListener<K,V> evictionListener)
public ConcurrentLRUCache(int size, int lowerWatermark)
public void setAlive(boolean live)
public Map<K,V> getOldestAccessedItems(int n)
n
- the number of oldest items neededpublic int size()
public void clear()
public Map<Object,org.apache.myfaces.shared.util.ConcurrentLRUCache.CacheEntry<K,V>> getMap()
public void destroy()
public ConcurrentLRUCache.Stats getStats()
Copyright © 2020 The Apache Software Foundation. All rights reserved.