Grails \ Hibernate: кэшировать или не кэшировать?

Какая лучшая политика кеширования в Hibernate \ Grails. Кэшировать все сущности и запросы или нет и как найти лучшее решение?

Здесь моя конфигурация спящего режима .

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 config

<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"
/>
5
задан Oleksandr 26 January 2011 в 12:23
поделиться