Ehcache 2.10.7 | Product Documentation | Ehcache Configuration Guide | Managing Data Life | Setting Expiration
 
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 cache without being accessed. The element expires at this limit and will no longer be returned from Ehcache . 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 cache regardless of use. The element expires at this limit and will no longer be returned from Ehcache . The default value is 0, which means no TTL eviction takes place (infinite lifetime).
*maxEntriesLocalDisk – The maximum sum total number of elements (cache entries) allowed on the disk tier for a cache. If this target is exceeded, eviction occurs to bring the count within the allowed target. The default value is 0, which means no eviction takes place (infinite size is allowed). A setting of 0 means that no eviction of the cache's entries takes place, and consequently can cause the node to run out of disk space.
*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.

Copyright © 2010-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.