Hi,
could someone point me to a document / article / Javadoc / anything that explains the in-depth workings of the L2 Cache ? I am particularly interesting in information about how it works (and why) about uncommitted transactions..
Basically, what I am doing is Importing 2+ million entries inside a single transaction.
For a few objects and Queries :
- If I use my own HashMap to cache the results, X iterations take 1 second.
- If I use Hibernate's L2 Cache + Query Cache, X iterations take 30 seconds.
=> My guess was that the cache was not used, so I started analyzing the debug logs.
And what appears to me (I may be wrong, please correct me), is that :
- Once an insert is committed, everything works perfectly
- However, if an insert is followed by selects, in the same transaction, Hibernate L2 / Query cache does NOT work as expected.
For each query, I get something like that :
52924 DEBUG [main] org.hibernate.cache.StandardQueryCache - Checking query s
paces for up-to-dateness: [AbstractAdministrativeEntity, Country]
52924 DEBUG [main] org.hibernate.cache.EhCache - key: AbstractAdmi
nistrativeEntity
52924 DEBUG [main] org.hibernate.cache.UpdateTimestampsCache - [AbstractAdmi
nistrativeEntity] last update timestamp: 4757644239814656, result set timestamp:
4757643992637440
52924 DEBUG [main] org.hibernate.cache.StandardQueryCache - cached query res
ults were not up to date
So, why are the results not up to date ? It does NOT happen if I commit the data, (in this case, I get a cache hit).
Thanks for your help,
Sami Dalouche
|