org.apache.ignite.cache.eviction.igfs

## Class IgfsPerBlockLruEvictionPolicy

- java.lang.Object
- - org.apache.ignite.cache.eviction.igfs.IgfsPerBlockLruEvictionPolicy

All Implemented Interfaces:
  Externalizable, Serializable, EvictionPolicy<IgfsBlockKey,byte[]>, IgniteMBeanAware

    public class IgfsPerBlockLruEvictionPolicy
    extends Object
    implements EvictionPolicy<IgfsBlockKey,byte[]>, IgniteMBeanAware, Externalizable

IGFS eviction policy which evicts particular blocks.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`IgfsPerBlockLruEvictionPolicy()` Default constructor.
`IgfsPerBlockLruEvictionPolicy(long maxSize, int maxBlocks)` Constructor.
`IgfsPerBlockLruEvictionPolicy(long maxSize, int maxBlocks, Collection<String> excludePaths)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `exclude(IgfsPath path)` Check whether provided path must be excluded from evictions.
`int` `getCurrentBlocks()` Gets current amount of blocks.
`long` `getCurrentSize()` Gets current size of data in all blocks.
`Collection<String>` `getExcludePaths()` Gets collection of regex for paths whose blocks must not be evicted.
`int` `getMaxBlocks()` Gets maximum allowed amount of blocks.
`long` `getMaxSize()` Gets maximum allowed size of all blocks in bytes.
`Object` `getMBean()`
`void` `onEntryAccessed(boolean rmv, EvictableEntry<IgfsBlockKey,byte[]> entry)` Callback for whenever entry is accessed.
`void` `readExternal(ObjectInput in)`
`IgfsPerBlockLruEvictionPolicy` `setExcludePaths(Collection<String> excludePaths)` Sets collection of regex for paths whose blocks must not be evicted.
`IgfsPerBlockLruEvictionPolicy` `setMaxBlocks(int maxBlocks)` Sets maximum allowed amount of blocks.
`IgfsPerBlockLruEvictionPolicy` `setMaxSize(long maxSize)` Sets maximum allowed size of data in all blocks in bytes.
`void` `writeExternal(ObjectOutput out)`

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

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

### Constructor Detail

#### IgfsPerBlockLruEvictionPolicy

    public IgfsPerBlockLruEvictionPolicy()

Default constructor.

#### IgfsPerBlockLruEvictionPolicy

    public IgfsPerBlockLruEvictionPolicy(long maxSize,
                                         int maxBlocks)

Constructor.

Parameters:
  `maxSize` - Maximum size. When reached, eviction begins.
  `maxBlocks` - Maximum amount of blocks. When reached, eviction begins.

#### IgfsPerBlockLruEvictionPolicy

    public IgfsPerBlockLruEvictionPolicy(long maxSize,
                                         int maxBlocks,
                                         @Nullable
                                         Collection<String> excludePaths)

Constructor.

Parameters:
  `maxSize` - Maximum size. When reached, eviction begins.
  `maxBlocks` - Maximum amount of blocks. When reached, eviction begins.
  `excludePaths` - Collection of regex for path which must not be evicted.

### Method Detail

#### onEntryAccessed

    public void onEntryAccessed(boolean rmv,
                                EvictableEntry<IgfsBlockKey,byte[]> entry)

Callback for whenever entry is accessed.

Specified by:
  `onEntryAccessed` in interface `EvictionPolicy<IgfsBlockKey,byte[]>`
Parameters:
  `rmv` - `True` if entry has been removed, `false` otherwise.
  `entry` - Accessed entry.

#### getMaxSize

    public long getMaxSize()

Gets maximum allowed size of all blocks in bytes.

Returns:
  Maximum allowed size of all blocks in bytes.

#### setMaxSize

    public IgfsPerBlockLruEvictionPolicy setMaxSize(long maxSize)

Sets maximum allowed size of data in all blocks in bytes.

Parameters:
  `maxSize` - Maximum allowed size of data in all blocks in bytes.
Returns:
  `this` for chaining.

#### getMaxBlocks

    public int getMaxBlocks()

Gets maximum allowed amount of blocks.

Returns:
  Maximum allowed amount of blocks.

#### setMaxBlocks

    public IgfsPerBlockLruEvictionPolicy setMaxBlocks(int maxBlocks)

Sets maximum allowed amount of blocks.

Parameters:
  `maxBlocks` - Maximum allowed amount of blocks.
Returns:
  `this` for chaining.

#### getExcludePaths

    public Collection<String> getExcludePaths()

Gets collection of regex for paths whose blocks must not be evicted.

Returns:
  Collection of regex for paths whose blocks must not be evicted.

#### setExcludePaths

    public IgfsPerBlockLruEvictionPolicy setExcludePaths(@Nullable
                                                         Collection<String> excludePaths)

Sets collection of regex for paths whose blocks must not be evicted.

Parameters:
  `excludePaths` - Collection of regex for paths whose blocks must not be evicted.
Returns:
  `this` for chaining.

#### getCurrentSize

    public long getCurrentSize()

Gets current size of data in all blocks.

Returns:
  Current size of data in all blocks.

#### getCurrentBlocks

    public int getCurrentBlocks()

Gets current amount of blocks.

Returns:
  Current amount of blocks.

#### getMBean

    public Object getMBean()

Specified by:
  `getMBean` in interface `IgniteMBeanAware`
Returns:
  MBean for this object.

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

#### exclude

    public boolean exclude(IgfsPath path)
                    throws IgniteCheckedException

Check whether provided path must be excluded from evictions.

Parameters:
  `path` - Path.
Returns:
  `True` in case non block of related file must be excluded.
Throws:
  `IgniteCheckedException` - In case of faulty patterns.

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.0
Release Date | : November 30 2018