Package org.apache.ignite.cache.eviction.lru

## Class LruEvictionPolicyFactory<K,​V>

- java.lang.Object
- - org.apache.ignite.cache.eviction.AbstractEvictionPolicyFactory<LruEvictionPolicy<K,​V>>
  - - org.apache.ignite.cache.eviction.lru.LruEvictionPolicyFactory<K,​V>

- All Implemented Interfaces:
    `Serializable`, `javax.cache.configuration.Factory<LruEvictionPolicy<K,​V>>`

      public class LruEvictionPolicyFactory<K,​V>
      extends AbstractEvictionPolicyFactory<LruEvictionPolicy<K,​V>>

  Factory class for `LruEvictionPolicy`. Creates cache Eviction policy based on `Least Recently Used (LRU)` algorithm and supports batch 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`. `LruEvictionPolicy` implementation is very efficient since it is lock-free and does not create any additional table-like data structures. The `LRU` ordering information is maintained by attaching ordering metadata to cache entries.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `LruEvictionPolicyFactory()` |
    `LruEvictionPolicyFactory​(int maxSize)` |
    `LruEvictionPolicyFactory​(int maxSize, int batchSize, long maxMemSize)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `LruEvictionPolicy<K,​V>` | `create()`

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

    - #### LruEvictionPolicyFactory

          public LruEvictionPolicyFactory()

    - #### LruEvictionPolicyFactory

          public LruEvictionPolicyFactory​(int maxSize)

      Parameters:
        `maxSize` - Maximum allowed size of cache before entry will start getting evicted.

    - #### LruEvictionPolicyFactory

          public LruEvictionPolicyFactory​(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

    - #### create

          public LruEvictionPolicy<K,​V> create()