OSCacheとUpdateTimestampsCache
hibernate.cache.use_query_cache true
This setting causes the creation of two new cache regions - one holding cached query result sets (org.hibernate.cache.StandardQueryCache), the other holding timestamps of the most recent updates to queryable tables (org.hibernate.cache.UpdateTimestampsCache)
http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#performance-querycache
クエリキャッシュを有効にすると、StandardQueryCache と UpdateTimestampsCache という CacheRegion が作られるということなので、UpdateTimestampsCache のAPIドキュメントを見てみると次のように書かれている。
we recommend that the the underlying cache not be configured for expiry at all. Note, in particular, that an LRU cache expiry policy is never appropriate.
http://www.hibernate.org/hib_docs/v3/api/org/hibernate/cache/UpdateTimestampsCache.html
UpdateTimestampsCacheのキャッシュにLRUは使うなということだが、OSCacheはCacheRegion毎に異なるキャッシュアルゴリズムを設定することができない。oscache.properties で
cache.algorithm=com.opensymphony.oscache.base.algorithm.LRUCache
としたら全てのCacheRegionがLRUになってしまう。
cache.algorithm=com.opensymphony.oscache.base.algorithm.UnlimitedCache
にして、UpdateTimestampsCacheはrefresh.period=-1(expireなし)、他のCacheRegionはrefresh.periodをあまり長くしないようにするしかないのかな。
EHCacheはCacheRegion毎に細かな設定ができるので、Hibernateのデフォルトの2次キャッシュになってるのだろうか?