org.apache.ignite.cache.eviction.sorted

## 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 for `SortedEvictionPolicy`. 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.

Note:Batch eviction is enabled only if maximum memory limit isn't set (`maxMemSize == 0`). `batchSize` elements will be evicted in this case. The default `batchSize` value is `1`.

Entries comparison based on `Comparator` instance if provided. Default `Comparator` behaviour is use cache entries keys for comparison that imposes a requirement for keys to implement `Comparable` interface.

User defined comparator should implement `Serializable` interface.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`SortedEvictionPolicyFactory()`
`SortedEvictionPolicyFactory(int maxSize)`
`SortedEvictionPolicyFactory(int maxSize, int batchSize, long maxMemSize)`

### Method Summary

All Methods Instance Methods Concrete Methods
`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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### SortedEvictionPolicyFactory

    public SortedEvictionPolicyFactory()

#### SortedEvictionPolicyFactory

    public SortedEvictionPolicyFactory(int maxSize)

#### SortedEvictionPolicyFactory

    public SortedEvictionPolicyFactory(int maxSize,
                                       int batchSize,
                                       long maxMemSize)

### 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()

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.8.1
Release Date | : May 21 2020