org.apache.ignite.internal.processors.cache

## Class GridCacheTtlManager

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.GridCacheManagerAdapter
  - - org.apache.ignite.internal.processors.cache.GridCacheTtlManager

All Implemented Interfaces:
  GridCacheManager

    public class GridCacheTtlManager
    extends GridCacheManagerAdapter

Eagerly removes expired entries from cache when `CacheConfiguration.isEagerTtl()` flag is set.

### Field Summary

Fields
`protected boolean` `hasPendingEntries` Indicates that
`protected long` `nextCleanTime` Timestamp when next clean try will be allowed.

### Fields inherited from class org.apache.ignite.internal.processors.cache.GridCacheManagerAdapter

`cctx, log, starting`

### Constructor Summary

Constructors
Constructor and Description
`GridCacheTtlManager()`

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `eagerTtlEnabled()`
`boolean` `expire(int amount)` Processes specified amount of expired entries.
`boolean` `hasPendingEntries()`
`void` `hasPendingEntries(boolean update)` Updates the flag `hasPendingEntries` with the given value.
`protected void` `onKernalStop0(boolean cancel)`
`long` `pendingSize()`
`void` `printMemoryStats()` Prints memory statistics (sizes of internal data structures, etc.).
`protected void` `start0()`
`void` `unregister()` Unregister this TTL manager of cache from periodical check on expired entries.

### Methods inherited from class org.apache.ignite.internal.processors.cache.GridCacheManagerAdapter

`context, kernalStartInfo, kernalStopInfo, log, onDisconnected, onKernalStart, onKernalStart0, onKernalStop, start, startInfo, stop, stop0, stopInfo, toString`

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

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

### Field Detail

#### hasPendingEntries

    protected volatile boolean hasPendingEntries

Indicates that

#### nextCleanTime

    protected volatile long nextCleanTime

Timestamp when next clean try will be allowed. Used for throttling on per-cache basis.

### Constructor Detail

#### GridCacheTtlManager

    public GridCacheTtlManager()

### Method Detail

#### start0

    protected void start0()
                   throws IgniteCheckedException

Overrides:
  `start0` in class `GridCacheManagerAdapter`
Throws:
  `IgniteCheckedException` - If failed.

#### eagerTtlEnabled

    public boolean eagerTtlEnabled()

Returns:
  `True` if eager ttl is enabled for cache.

#### onKernalStop0

    protected void onKernalStop0(boolean cancel)

Overrides:
  `onKernalStop0` in class `GridCacheManagerAdapter`
Parameters:
  `cancel` - Cancel flag.

#### unregister

    public void unregister()

Unregister this TTL manager of cache from periodical check on expired entries.

#### pendingSize

    public long pendingSize()
                     throws IgniteCheckedException

Returns:
  The size of pending entries.
Throws:
  `IgniteCheckedException` - If failed.

#### hasPendingEntries

    public void hasPendingEntries(boolean update)

Updates the flag `hasPendingEntries` with the given value.

Parameters:
  `update` - `true` if the underlying pending tree has entries with expire policy enabled.

#### hasPendingEntries

    public boolean hasPendingEntries()

Returns:
  `true` if the underlying pending tree has entries with expire policy enabled.

#### printMemoryStats

    public void printMemoryStats()

Prints memory statistics (sizes of internal data structures, etc.). NOTE: this method is for testing and profiling purposes only.

Specified by:
  `printMemoryStats` in interface `GridCacheManager`
Overrides:
  `printMemoryStats` in class `GridCacheManagerAdapter`

#### expire

    public boolean expire(int amount)

Processes specified amount of expired entries.

Parameters:
  `amount` - Limit of processed entries by single call, `-1` for no limit.
Returns:
  `True` if unprocessed expired entries remains.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.9.1
Release Date | : December 9 2020