116 WebSphere eXtreme Scale Best Practices for Operation and Management
6.2.1 Default (time-to-live) evictor
A default evictor is created with every backing map that removes entries based on a
time-to-live (TTL) concept. The TTL evictor is not active by default but can be enabled
programmatically using the BackingMap interface, or it can be enabled through the
ObjectGrid descriptor XML file.
When enabled, the TTL evictor uses an algorithm based on an expiration delay (time-to-live),
which is added to a reference time. The reference time can be the creation time of an entry in
the map or the last time that an entry was accessed or updated. This behavior is defined by
the TTLtype attribute (programmatically) or the ttlEvictorType attribute in the XML file. The
TTL type is one of the following types:
򐂰 NONE
Specifies that entries never expire and, therefore, are never removed from the map,
effectively disabling the evictor
򐂰 CREATION_TIME
Specifies that entries are evicted, depending upon when they were created
򐂰 LAST_ACCESS_TIME
Specifies that entries are evicted, depending upon when they were last accessed and
whether they were read or updated at the time
򐂰 LAST_UPDATE_TIME
Specifies that entries are evicted, depending upon when they were last updated
To enable the TTL evictor for a specific map, set the TTL type and a time-to-live value in
seconds. This value is the expiration delay, which will be used to determine when to evict
entries.
Example 6-1 shows an example of enabling TTL evictors for each of three maps using the
ObjectGrid descriptor XML file.
Example 6-1 Enabling TTL evictors
<?xml version="1.0" encoding="UTF-8"?>
<objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"
xmlns="http://ibm.com/ws/objectgrid/config">
<objectGrids>
<objectGrid name="grid1">
<backingMap name="map1" ttlEvictorType="NONE" />
<backingMap name="map2" ttlEvictorType="LAST_ACCESS_TIME"
timeToLive="1800" />
<backingMap name="map3" ttlEvictorType="CREATION_TIME"
timeToLive="1200" />
</objectgrid>
</objectGrids>
If you use CREATION_TIME, an entry is evicted when its time from creation equals its
timeToLive value. If you set the timeToLive value to 10 seconds, the entry is evicted
automatically 10 seconds after it was inserted. Take caution when setting this value. This
evictor type is best used when reasonably high numbers of additions to the cache exist that
are used only for a set amount of time. With this strategy, anything that is created is removed
after the set amount of time. CREATION_TIME is useful in scenarios, such as refreshing

Get WebSphere eXtreme Scale Best Practices for Operation and Management now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.