title: Change domain class cache setting outside of domain class
body: <p>I have a plugin that has a bunch of domain classes. This plugin is used by multiple applications. </p>
  
  <p>My problem is that I can't specify the mapping->cache setting in the domain classes themselves (as they need to have different values depending up the application that uses them). For example, in Application A, I'd like to have domain class X read-only cached, and domain class Y not cached. In Application B, I'd like to have domain class X transactional cached, and domain class Y read-only cached. </p>
  
  <p>What I'd like (I'm hoping this is already available) is something like: </p>
  
  <pre><code>grails.gorm.default.mapping { cache true } 
  </code></pre>
  
  <p>But instead of being global, I can apply to just a specific domain class, something like: </p>
  
  <pre><code>grails.gorm.com.integralblue.domain.User.mapping { cache true } 
  </code></pre>
  
  <hr>
  
  <p>Someone had suggested having each domain class checking the grails config, something like:   </p>
  
  <pre><code>static mapping = {
      cache: Holders.grailsApplication.config.com.package.Person.cache ?: false
  }
  </code></pre>
  
  <p>And the Config:</p>
  
  <pre><code>com.package.Person.cache = true
  </code></pre>
  
  <p>but I'd like to avoid that if possible</p>
  
  <p>Thanks!</p>