We are considering using ehcache (1.6.0-beta5) to enable second level caching of a number of tables which are never modified. We have set up a read-only ehcache region for this table and currently it seems to be working fine. The Hibnerate POJOs stored in the cache are all immutable.
One of the developers here raised an issue that there is a significant performance decrease in the time taken to 'hydrate' objects from the ehcache, that is, the mapping from ehcache's internal representation of an entity to an actual java object. Instead he suggested we store objects manually in a cache of our own. This would require significant modification of our code and I have reservations on how big the improvement would be.
My questions are:
- Is this decrease in performance really significant?
- If the entities are immutable in a read-only cache, would ehcache actually need to do any hydration at all? Couldn't it just store the objects directly?
Thanks for any help.