Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Keys are getting expired in Ehcache  RSS feed

vShyam Sundar
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am using Ehcache 1.6.2 for putting serialized java objects
and then retrieving back the java objects based on the key.

What's happening in my case was some of the keys are getting expired.

My Ehcache configuration are as follows

No Of elemenets in memory = 100
eternal = true
Memory eviction algorithm is set to LRU
set overflowtodisk as true
and diskstore path is also set

Since I have set eternal to true, I knew elements will not expire.

But in my case when I check isKeyincache(key) its returning false. Whereas when
I try to get the object from the cache I'am able to get the object with all the values and
after getting the object if I check isKeyinCache(Key) again its returning true.

When I used getKeys() and getSize() methods its returning the exact keys and size that was putted in ehcache, Because this methods return all things including the expired ones.

However this is happening only
2 out of 10 occurrences randomly, when I load 119(No of elements in memory set to 100).

I also suspect that this might be because of LRU eviction policy. However eviction policy states that element will be expired but in my case keys are getting expired and not the elements.

Please let me know if some one else has faced same kind of issue.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!