Class SortedEvictionPolicyFactory<K,V>
- java.lang.Object
-
- org.apache.ignite.cache.eviction.AbstractEvictionPolicyFactory<SortedEvictionPolicy<K,V>>
-
- org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicyFactory<K,V>
-
- All Implemented Interfaces:
Serializable
,javax.cache.configuration.Factory<SortedEvictionPolicy<K,V>>
public class SortedEvictionPolicyFactory<K,V> extends AbstractEvictionPolicyFactory<SortedEvictionPolicy<K,V>>
Factory class forSortedEvictionPolicy
. Creates cache Eviction policy which will select the minimum cache entry for eviction.The eviction starts in the following cases:
- The cache size becomes
batchSize
elements greater than the maximum size. - The size of cache entries in bytes becomes greater than the maximum memory size. The size of cache entry calculates as sum of key size and value size.
maxMemSize == 0
).batchSize
elements will be evicted in this case. The defaultbatchSize
value is1
.Entries comparison based on
Comparator
instance if provided. DefaultComparator
behaviour is use cache entries keys for comparison that imposes a requirement for keys to implementComparable
interface.User defined comparator should implement
Serializable
interface.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SortedEvictionPolicyFactory()
SortedEvictionPolicyFactory(int maxSize)
SortedEvictionPolicyFactory(int maxSize, int batchSize, long maxMemSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SortedEvictionPolicy<K,V>
create()
Comparator<EvictableEntry<K,V>>
getComp()
Gets entries comparator.void
setComp(Comparator<EvictableEntry<K,V>> comp)
Sets entries comparator.-
Methods inherited from class org.apache.ignite.cache.eviction.AbstractEvictionPolicyFactory
getBatchSize, getMaxMemorySize, getMaxSize, setBatchSize, setMaxMemorySize, setMaxSize
-
-
-
-
Constructor Detail
-
SortedEvictionPolicyFactory
public SortedEvictionPolicyFactory()
-
SortedEvictionPolicyFactory
public SortedEvictionPolicyFactory(int maxSize)
- Parameters:
maxSize
- Maximum allowed size of cache before entry will start getting evicted.
-
SortedEvictionPolicyFactory
public SortedEvictionPolicyFactory(int maxSize, int batchSize, long maxMemSize)
- Parameters:
maxSize
- Maximum allowed size of cache before entry will start getting evicted.batchSize
- Batch size.maxMemSize
- Maximum allowed cache size in bytes.
-
-
Method Detail
-
getComp
public Comparator<EvictableEntry<K,V>> getComp()
Gets entries comparator.- Returns:
- entry comparator.
-
setComp
public void setComp(Comparator<EvictableEntry<K,V>> comp)
Sets entries comparator.- Parameters:
comp
- entry comparator.
-
create
public SortedEvictionPolicy<K,V> create()
-
-