public class GridCacheRandomEvictionPolicy<K,V> extends Object implements GridCacheEvictionPolicy<K,V>, GridCacheRandomEvictionPolicyMBean
getMaxSize() parameter. This implementation is
extremely light weight, lock-free, and does not create any data structures to maintain
any order for eviction.
Random eviction will provide the best performance over any key set in which every key has the same probability of being accessed.
| Constructor and Description |
|---|
GridCacheRandomEvictionPolicy()
Constructs random eviction policy with all defaults.
|
GridCacheRandomEvictionPolicy(int max)
Constructs random eviction policy with maximum size.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getMaxSize()
Gets maximum allowed size of cache before entry will start getting evicted.
|
void |
onEntryAccessed(boolean rmv,
GridCacheEntry<K,V> entry)
Callback for whenever entry is accessed.
|
void |
setMaxSize(int max)
Sets maximum allowed size of cache before entry will start getting evicted.
|
String |
toString() |
public GridCacheRandomEvictionPolicy()
public GridCacheRandomEvictionPolicy(int max)
max - Maximum allowed size of cache before entry will start getting evicted.public int getMaxSize()
getMaxSize in interface GridCacheRandomEvictionPolicyMBeanpublic void setMaxSize(int max)
setMaxSize in interface GridCacheRandomEvictionPolicyMBeanmax - Maximum allowed size of cache before entry will start getting evicted.public void onEntryAccessed(boolean rmv,
GridCacheEntry<K,V> entry)
onEntryAccessed in interface GridCacheEvictionPolicy<K,V>rmv - True if entry has been removed, false otherwise.entry - Accessed entry.Copyright © 2014. All rights reserved.