public class CacheLruEvictionPolicy<K,V> extends Object implements CacheEvictionPolicy<K,V>, CacheLruEvictionPolicyMBean
Least Recently Used (LRU) algorithm. This
implementation is very efficient since it is lock-free and does not
create any additional table-like data structures. The LRU ordering
information is maintained by attaching ordering metadata to cache entries.| Constructor and Description |
|---|
CacheLruEvictionPolicy()
Constructs LRU eviction policy with all defaults.
|
CacheLruEvictionPolicy(int max)
Constructs LRU eviction policy with maximum size.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getCurrentSize()
Gets current queue size.
|
int |
getMaxSize()
Gets maximum allowed size of cache before entry will start getting evicted.
|
void |
onEntryAccessed(boolean rmv,
EvictableEntry<K,V> entry)
Callback for whenever entry is accessed.
|
Collection<EvictableEntry<K,V>> |
queue()
Gets read-only view on internal
FIFO queue in proper order. |
void |
setMaxSize(int max)
Sets maximum allowed size of cache before entry will start getting evicted.
|
String |
toString() |
public CacheLruEvictionPolicy()
public CacheLruEvictionPolicy(int max)
max - Maximum allowed size of cache before entry will start getting evicted.public int getMaxSize()
getMaxSize in interface CacheLruEvictionPolicyMBeanpublic void setMaxSize(int max)
setMaxSize in interface CacheLruEvictionPolicyMBeanmax - Maximum allowed size of cache before entry will start getting evicted.public int getCurrentSize()
getCurrentSize in interface CacheLruEvictionPolicyMBeanpublic Collection<EvictableEntry<K,V>> queue()
FIFO queue in proper order.'FIFO' queue.public void onEntryAccessed(boolean rmv,
EvictableEntry<K,V> entry)
onEntryAccessed in interface CacheEvictionPolicy<K,V>rmv - True if entry has been removed, false otherwise.entry - Accessed entry.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0-RC3 Release Date : March 24 2015