knorv
knorv

Reputation: 50117

Caching in Grails - what is cached by default and what can be enabled?

I'm curious about the support for database/GORM object caching provided by the Grails framework.

Upvotes: 2

Views: 1214

Answers (2)

Victor Sergienko
Victor Sergienko

Reputation: 13475

3) We disabled disk cache overflow. Had to explicitly create ehcache.xml for that, from ehcache-core-1.7.1.jar/ehcache-failsafe.xml.

Disk cache overflow only made problems for us due to being slow and IO error prone.

Upvotes: 0

Vincent Giguère
Vincent Giguère

Reputation: 730

Grails uses Hibernate for GORM, so the database caching features are actually provided by Hibernate.

  1. The Hibernate first level cache is enabled (which only lasts approximately the time of a user request). It can not be disabled.

  2. The Hibernate second level cache is also enabled, but can be turned off by configuration. This cache will hold data for a long time (configurable by object type) unless something invalidates the data (an update)

For heavy-read applications, second-level cache should be enabled, you will save a lot of trips to your database, and it is 100% transparent to your application (almost no cost).

Regards,

Vincent

Upvotes: 5

Related Questions