I'm using EHCache 1.6.2 + Hibernate 3.3.2. I've noticed many messages "org.hibernate.cache.ReadWriteCache - An item was expired by the cache while it was locked" in my logs.
After adding some logs into EHCache source, I've discovered that Hibernate's message corresponds to items evicted by EHCache when the cache is full.
Is this a normal behavior? why are these items evicted by the (default) LRU algorithm, although there seem to have been accessed (and locked) by Hibernate just before??
I'm not sure of the consequences on Hibernate side when this happens, but Hibernate's message is very annoying because it has a warning log level.
Just a wild guess: I see that cache elements have a lastAccessTime=0 when they are created (at least in Hibernate case), and thus can be selected by LruPolicy for eviction.
Shouldn't lastAccessTime be initialized with System.currentTimeMillis() at element creation?