Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Keys are getting expired in Ehcache

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.

Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic