public class LRUEviction extends java.lang.Object implements EvictionPolicy
EvictionPolicy.EvictionType| Modifier and Type | Field and Description |
|---|---|
protected java.util.LinkedHashMap<CacheKey,java.lang.Long> |
accessTimes |
protected Cache |
cache
The cache that is associated to that policy instance
|
protected java.util.concurrent.ConcurrentLinkedQueue |
msg |
protected java.util.ArrayDeque<CacheKey> |
pendingEvictions |
| Constructor and Description |
|---|
LRUEviction(int initialCapacity)
Constructor that gets the cache passed
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<CacheKey> |
evictMany(int n) |
CacheKey |
evictNext()
Evict the next element from the cache
This one should provide O(1) complexity
|
Cache |
getCache() |
java.lang.String |
getName() |
EvictionPolicy.EvictionType |
getType() |
boolean |
reset(CacheKey cacheKey)
Resets the state that the eviction policy maintains about the cache key
|
int |
resetAll()
Resets the entire state of the eviction data
|
void |
setCache(Cache cache)
Sets the cache that is associated to this policy instance
|
void |
touch(CacheKey cacheKey)
Indicates that a cache key was touched
This one should provide O(1) complexity
|
protected Cache cache
protected java.util.LinkedHashMap<CacheKey,java.lang.Long> accessTimes
protected java.util.ArrayDeque<CacheKey> pendingEvictions
protected java.util.concurrent.ConcurrentLinkedQueue msg
public LRUEviction(int initialCapacity)
initialCapacity - public void setCache(Cache cache)
EvictionPolicysetCache in interface EvictionPolicycache - The cache instancepublic Cache getCache()
getCache in interface EvictionPolicypublic EvictionPolicy.EvictionType getType()
getType in interface EvictionPolicypublic java.lang.String getName()
getName in interface EvictionPolicypublic CacheKey evictNext()
EvictionPolicyevictNext in interface EvictionPolicypublic java.util.List<CacheKey> evictMany(int n)
evictMany in interface EvictionPolicyn - The number of entries to evictpublic void touch(CacheKey cacheKey)
EvictionPolicytouch in interface EvictionPolicycacheKey - The key within the cachepublic boolean reset(CacheKey cacheKey)
EvictionPolicyreset in interface EvictionPolicypublic int resetAll()
EvictionPolicyresetAll in interface EvictionPolicyCopyright © 2025. All rights reserved.