org.apache.ignite.cache.eviction.fifo

## Class CacheFifoEvictionPolicy<K,V>

- java.lang.Object
- - org.apache.ignite.cache.eviction.fifo.CacheFifoEvictionPolicy<K,V>

All Implemented Interfaces:
  CacheEvictionPolicy<K,V>, CacheFifoEvictionPolicyMBean

    public class CacheFifoEvictionPolicy<K,V>
    extends Object
    implements CacheEvictionPolicy<K,V>, CacheFifoEvictionPolicyMBean

Eviction policy based on `First In First Out (FIFO)` algorithm. This implementation is very efficient since it does not create any additional table-like data structures. The `FIFO` ordering information is maintained by attaching ordering metadata to cache entries.

### Constructor Summary

Constructors
Constructor and Description
`CacheFifoEvictionPolicy()` Constructs FIFO eviction policy with all defaults.
`CacheFifoEvictionPolicy(int max)` Constructs FIFO eviction policy with maximum size.

### Method Summary

Methods
`int` `getCurrentSize()` Gets current queue size.
`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.
`Collection<EvictableEntry<K,V>>` `queue()` Gets read-only view on internal `FIFO` queue in proper order.
`void` `setMaxSize(int max)` Sets maximum allowed size of cache before entry will start getting evicted.
`String` `toString()`

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

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

### Constructor Detail

#### CacheFifoEvictionPolicy

    public CacheFifoEvictionPolicy()

Constructs FIFO eviction policy with all defaults.

#### CacheFifoEvictionPolicy

    public CacheFifoEvictionPolicy(int max)

Constructs FIFO eviction policy with maximum size. Empty entries are allowed.

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

### Method Detail

#### getMaxSize

    public int getMaxSize()

Gets maximum allowed size of cache before entry will start getting evicted.

Specified by:
  `getMaxSize` in interface `CacheFifoEvictionPolicyMBean`
Returns:
  Maximum allowed size of cache before entry will start getting evicted.

#### setMaxSize

    public void setMaxSize(int max)

Sets maximum allowed size of cache before entry will start getting evicted.

Specified by:
  `setMaxSize` in interface `CacheFifoEvictionPolicyMBean`
Parameters:
  `max` - Maximum allowed size of cache before entry will start getting evicted.

#### getCurrentSize

    public int getCurrentSize()

Gets current queue size.

Specified by:
  `getCurrentSize` in interface `CacheFifoEvictionPolicyMBean`
Returns:
  Current queue size.

#### queue

    public Collection<EvictableEntry<K,V>> queue()

Gets read-only view on internal `FIFO` queue in proper order.

Returns:
  Read-only view ono internal `'FIFO'` queue.

#### onEntryAccessed

    public void onEntryAccessed(boolean rmv,
                       EvictableEntry<K,V> entry)

Callback for whenever entry is accessed.

Specified by:
  `onEntryAccessed` in interface `CacheEvictionPolicy<K,V>`
Parameters:
  `rmv` - `True` if entry has been removed, `false` otherwise.
  `entry` - Accessed entry.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0-RC3
Release Date | : March 24 2015