Setting Expiration
Data entries expire based on parameters with configurable values. When eviction occurs, expired elements are the first to be removed. Having an effective expiration configuration is critical to optimizing the use of resources such as heap and maintaining overall performance.
To add expiration, specify values for the following <cache> attributes, and tune these values based on results of performance tests:
timeToIdleSeconds – The maximum number of seconds an element can exist in the
BigMemory data store without being accessed. The element expires at this limit and will no longer be returned from
BigMemory Max. The default value is 0, which means no TTI eviction takes place (infinite lifetime).
timeToLiveSeconds – The maximum number of seconds an element can exist in the
BigMemory data store regardless of use. The element expires at this limit and will no longer be returned from
BigMemory Max. The default value is 0, which means no TTL eviction takes place (infinite lifetime).
maxEntriesInCache – The maximum sum total number of elements (cache entries) allowed for a distributed cache in all Terracotta clients. If this target is exceeded, eviction occurs to bring the count within the allowed target. The default value is 0, which means that the cache will not undergo capacity eviction (but periodic and resource evictions are still allowed). Note that
maxEntriesInCache reflects storage allocated on the Terracotta Server Array.
eternal – If the cache's
eternal flag is set, it overrides any finite TTI/TTL values that have been set. Individual cache elements may also be set to eternal. Eternal elements and caches do not expire, however they may be evicted.
For information about how configuration can impact eviction, see
How Configuration Affects Element
Flushing and Eviction.