5
什麼是Hibernate \ Grails中最好的緩存策略。是否緩存所有實體和查詢以及如何找到最佳解決方案?Grails Hibernate:緩存還是不緩存?
這裏我的休眠配置。
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = true
cache.provider_class = 'org.hibernate.cache.EhCacheProvider'
connection.useUnicode = true
connection.characterEncoding = 'UTF-8'
connection.provider_class = 'org.hibernate.connection.C3P0ConnectionProvider'
dialect = 'org.hibernate.dialect.MySQL5InnoDBDialect'
order_updates = true
c3p0.min_size = 5
c3p0.max_size = 20
c3p0.max_statements = 20 * 10
c3p0.idle_test_period = 15 * 60
}
的Ehcache配置
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
maxElementsOnDisk="10000000"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
diskSpoolBufferSizeMB="100"
memoryStoreEvictionPolicy="LRU"
/>
<cache
name="org.hibernate.cache.StandardQueryCache"
maxElementsInMemory="50"
eternal="false"
timeToLiveSeconds="120"
overflowToDisk="true"
/>
最好的緩存策略是:不緩存!??當你寫這個的時候你高的地方? – 2014-03-05 14:44:18