Reputation: 18865
I'd like to implement the following algorythm above Ehcache :
But I never get an expired element (Element.isExpired()). I tried to play with my cache configuration (especially TimeToLive and TimeToIdle) but I cant seem to get it to work as I want. I can list the keys in the cache, but if I "get()" an expired element, I always get a null.
What am I doing wrong ?
Upvotes: 8
Views: 2853
Reputation: 625147
You're not doing anything wrong. The documentation says that getting an expired element will remove it from the cache and return null.
I suspect the only time an element will come up as expired is if you have an event listener listenings for element expiry events but I can't say I've ever tested this.
Upvotes: 4