Hibernate query cache size and expiration configurable?

D

David

Guest
In a web application i have configured in Hibernate 4.1.4 both query and second level cache:

<!-- Cache -->
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</property>
<property name="net.sf.ehcache.configurationResourceName">resources/ehcache.xml</property>
<property name="hibernate.cache.use_query_cache">true</property>


Everything is working fine. In the file ehcache.xml i'm able to configure the size and allocation of the second level cache:

<ehcache>
<diskStore path="java.io.tmpdir"/>
<defaultCache
maxElementsInMemory="30000"
eternal="false"
timeToIdleSeconds="600"
timeToLiveSeconds="600"
overflowToDisk="false"
maxElementsOnDisk="10000000"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"/>
</ehcache>


But what about the query cache? How many different queries are stored? How long before expire?

I'm tunning this, and want to synchronize second level cache and query cache expiration, but how? Thanks in adavance.

Continue reading...
 
Top