public class RandomEvictionPolicy<K,V> extends Object implements EvictionPolicy<K,V>, RandomEvictionPolicyMBean, Externalizable
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 |
---|
RandomEvictionPolicy()
Constructs random eviction policy with all defaults.
|
RandomEvictionPolicy(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,
EvictableEntry<K,V> entry)
Callback for whenever entry is accessed.
|
void |
readExternal(ObjectInput in) |
void |
setMaxSize(int max)
Sets maximum allowed size of cache before entry will start getting evicted.
|
String |
toString() |
void |
writeExternal(ObjectOutput out) |
public RandomEvictionPolicy()
public RandomEvictionPolicy(int max)
max
- Maximum allowed size of cache before entry will start getting evicted.public int getMaxSize()
getMaxSize
in interface RandomEvictionPolicyMBean
public void setMaxSize(int max)
setMaxSize
in interface RandomEvictionPolicyMBean
max
- Maximum allowed size of cache before entry will start getting evicted.public void onEntryAccessed(boolean rmv, EvictableEntry<K,V> entry)
onEntryAccessed
in interface EvictionPolicy<K,V>
rmv
- True
if entry has been removed, false
otherwise.entry
- Accessed entry.public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
Follow @ApacheIgnite
Ignite Fabric : ver. 1.1.0-incubating Release Date : May 20 2015