wood burning stoves 2.0*
The moose likes EhCache and the fly likes Keys are getting expired in Ehcache Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Caching » EhCache
Bookmark "Keys are getting expired in Ehcache" Watch "Keys are getting expired in Ehcache" New topic
Author

Keys are getting expired in Ehcache

vShyam Sundar
Ranch Hand

Joined: Oct 13, 2010
Posts: 60
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.

Thanks,
Shyam.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Keys are getting expired in Ehcache
 
Similar Threads
using ehcache with hibernate please answer this
"Cached Item Was Locked" causing Select Statement using Hibernate and EHCache
What is the proper configuration for OpenJPA using ehcache as a distributed second level cache?
JBOSS Cache:LRU Eviction algorithm not removing nodes
distributed caching with ehcache