Apache Ignite Documentation

GridGain Developer Hub - Apache Ignitetm

Welcome to the Apache Ignite developer hub run by GridGain. Here you'll find comprehensive guides and documentation to help you start working with Apache Ignite as quickly as possible, as well as support if you get stuck.


GridGain also provides Community Edition which is a distribution of Apache Ignite made available by GridGain. It is the fastest and easiest way to get started with Apache Ignite. The Community Edition is generally more stable than the Apache Ignite release available from the Apache Ignite website and may contain extra bug fixes and features that have not made it yet into the release on the Apache website.


Let's jump right in!


Documentation     Ask a Question     Download


Javadoc     Scaladoc     Examples

Expiry Policies

Expiry Policy specifies the amount of time that must pass before an entry is considered expired. Time can be counted from creation, last access, or modification time.

Your deployment's memory configuration will determine how the expiration policies function:

  • In-Memory Mode (data is stored solely in RAM): expired entries are purged from RAM completely.
  • Memory + Ignite persistence: expired entries are removed from both memory and disk tiers. Note that expiry policies will remove entries from the partition files on disk without freeing up space. The space will be reused to write subsequent entries.
  • Memory + 3rd party persistence: expired entries are removed from the memory tier only (Ignite) and left untouched in the 3​rd party persistence (RDBMS, NoSQL, and other databases).
  • Memory + Swap: expired entries are removed from both RAM and swap files.

Expiry Policy can be configured using any of the predefined implementations of javax.cache.expiry.ExpiryPolicy:

Class name

creation time

last access time

last update time














Custom ExpiryPolicy implementations are also allowed.

Expiry Policy can be configured in CacheConfiguration. This policy will be used for all entries inside the cache.

<bean class="org.apache.ignite.configuration.CacheConfiguration">
    <property name="expiryPolicyFactory">
        <bean class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf">
                <bean class="javax.cache.expiry.Duration">
                    <constructor-arg value="MINUTES"/>
                    <constructor-arg value="5"/>

Also, it is possible to change or set Expiry Policy for individual operations on the cache.

IgniteCache<Object, Object> cache = cache.withExpiryPolicy(
        new CreatedExpiryPolicy(new Duration(TimeUnit.SECONDS, 5)));

This policy will be used for each operation invoked on the returned cache instance.

Eager TTL

Entries that are expired can be removed from cache either eagerly or when they are touched by different cache operations. If there is at least one cache configured with eager TTL enabled, Ignite will create a single thread to clean up expired entries in the background.

Eager TTL can be enabled or disabled via the CacheConfiguration.eagerTtl property (default value is true):

<bean class="org.apache.ignite.configuration.CacheConfiguration">
    <property name="eagerTtl" value="true"/>

Updated about a year ago

Expiry Policies

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.