These 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)?
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.