[Java programming language only]

Evictors

Evictors remove data from the data grid. You can configure an evictor for a dynamic map and a default map on a simple grid.

Evictor types

The evictor removes entries based on a time to live concept. You can select an evictor that is based on the time it was created, on the time it was last accessed, or updated. By default, an evictor is created with a dynamic map. To enable an evictor on a default map for a simple grid, see Configuring a time to live (TTL) evictor.
None

Specifies that entries never expire and therefore are never removed from the map.

Creation time

Specifies that entries are evicted depending on when they were created.

If you are using the Creation time evictor, the evictor evicts an entry when its time from creation equals its TTL value, which is set in milliseconds in your application configuration. If you set the TTL TTL value to 10 seconds, the entry is automatically evicted ten seconds after it was inserted.

It is important to take caution when setting this value for the Creation time evictor type. This evictor is best used when reasonably high amounts of additions to the cache exist that are only used for a set amount of time. With this strategy, anything that is created is removed after the set amount of time.

The Creation time evictor type is useful in scenarios such as refreshing stock quotes every 20 minutes or less. Suppose a Web application obtains stock quotes, and getting the most recent quotes is not critical. In this case, the stock quotes are cached in a data grid for 20 minutes. After 20 minutes, the map entries expire and are evicted. Every twenty minutes or so, the data grid refreshes the data with data from the database. The database is updated every 20 minutes with the most recent stock quotes.

Last access time

Specifies that entries are evicted depending upon when they were last accessed, whether they were read or updated.

Last update time

Specifies that entries are evicted depending upon when they were last updated.

If you are using the Last access time or the Last update time evictor type , set the TTL value to a lower number than if you are using the Creation time evictor. The entries are reset every time it is accessed. In other words, if the value is equal to 15 and an entry has existed for 14 seconds but then gets accessed, it does not expire again for another 15 seconds. If you set the TTL value to a relatively high number, many entries might never be evicted. However, if you set the value to something like 15 seconds, entries might be removed when they are not often accessed.

The Last access time or Last update time evictor type are useful in scenarios such as holding session data from a client, using a data grid map. Session data must be destroyed if the client does not use the session data for some period of time. For example, the session data times out after 30 minutes of no activity by the client. In this case, using an evictor type of Last access time or Last update time with the TTL value set to 30 minutes is appropriate for this application.