Instructions on eternal and timetoliveseconds and Timetoidleseconds in the Ehcache cache

Source: Internet
Author: User

Today found a development project started with a warning prompt: Cache ' xx ' is set to eternal but also has Ttl/tti set, found to be ehcache cache settings conflict

So decided to mark it here, to deepen the memory, specifically as follows:

Timetoliveseconds: Cache from the time of creation to the expiration of the time unit of seconds, the default is 0, representing an infinite length, that is, the cache never expires;

Timetoidleseconds: After the cache is created, the time interval at which the last access cache expires, the unit is seconds, the default is 0, never expires;

Eternal: Cache is permanently valid (True/false)

When you configure the Eternal property to True, if you configure Timetoliveseconds/timetoidleseconds to be not 0 at the same time, the program will report the above warning

Let's talk about the relationship between them:

Eternal, True indicates that the cache is permanently valid and false indicates that it is not permanently valid

Primarily for use between Timetoliveseconds and Timetoidleseconds (when individually configured, described above)

Examples: timetoliveseconds =3600 timetoidleseconds =300

The above configuration represents 3,600 seconds of cache validity (one hours since the cache was set up) and, in a valid one hours, if the cache is not accessed for five minutes in a row, the cache fails, especially if the cache access is never interrupted, and the cache expires after one hours.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.