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
batchSizeelements 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).batchSizeelements will be evicted in this case. The defaultbatchSizevalue is1.Entries comparison based on
Comparatorinstance if provided. DefaultComparatorbehaviour is use cache entries keys for comparison that imposes a requirement for keys to implementComparableinterface.User defined comparator should implement
Serializableinterface.- 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.voidsetComp(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()
-
-