TimeToLiveSeconds and timeToIdleSeconds ehcache configuration

configurationehcache

My app sometimes goes unused for 24 hours or more but when it does get a request, it is very slow because the data has to be fetched from database. Here is the current ehcache configuration:

 timeToIdleSeconds="120"
 timeToLiveSeconds="120"

I am considering using the following configuration:

 timeToIdleSeconds="172800"
 timeToLiveSeconds="0"

i.e. it never expires according to timeToLiveSeconds and the cache waits 48 hours (48*60*60=172 800) after last access before expiring.

Does that make sense at all?

Thanks in advance,

Julien.

Best Answer

That makes sense, the default settings of 120/120 are definitely not working for you. Also make sure you set eternal="false", since having it true overrides the timeToIdle and timeToLive settings.

Related Topic