开发者

What are some good examples when the default Grails cache settings should be tweaked?

The开发者_运维百科se are the default Hibernate settings in Grails (found in conf/DataSource.groovy):

hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = true
    cache.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider'
}

What are some good examples of circumstances under which one would like to:

  • disable the second level cache,
  • disable the query cache, or
  • change the default cache provider (EhCacheProvider)?


It is difficult to give generic guidance on using cache as the best approach IMHO is always to build some metrics for the system and validate the effect cache has on those metrics.

I assume you realise that despite the above default settings in grails no queries or results are cached at all by default as cache is only used when explicitly enabled for specific queries/associations.


In our project we are using the Datasources plug in to be able to connect to another database. This database is managed by another system, so we can't cache these classes because we don't have a way to know when they are updated, so for this datasource we disabled the second-level cache and the query cache. Just an example.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜