How to configure distributed cache in grails (do not use Terracota)

I want to deploy my application (Grails 1.3.5) in two or more tomcats (7.0). I managed to do it without problems, but now I want to use RMI configuration My cache (ehcache).

What I have done so far is to create two ehcache.xml and save them in the lib folder of each tomcat. In the ehcache file I Three caches are declared:

> defaultCache
> org.hibernate.cache.StandardQueryCache
> org.hibernate.cache.UpdateTimestampsCache

Each cache has one RMI replicator. This is great but my question is whether I still have to declare each of my Grails domain classes in the ehcache.xml file. If I do this, I will have the same declaration twice: one in ehcache.xml The other is in the class itself (I have set cache = true in the class);

class Book {
static mapping = {
...
cache true
}
}

Yes Yes, you need to set it in two places. ehcache.xml values ​​configure cache settings, but unless caching is enabled for each domain class (and optional mapping set), they will be ignored.

Usually, you will not use the same settings in the defaultCache block, because each domain class usually requires different settings, for example

 maxElementsInMemory='1000'
eternal='true'
maxElementsOnDisk='0'>

class='net .sf.ehca che.distribution.RMICacheReplicatorFactory'
properties='replicateAsynchronously=false
replicatePutsViaCopy=false,
replicateUpdatesViaCopy=false,
replicatePuts=true,
replicateUpdates=true,
replicateRemovals=true'
/>

I want to deploy me in two or more tomcats (7.0) Application (Grails 1.3.5). I managed to do it without problems, but now I want to configure my cache (ehcache) using RMI.

What I have done so far is to create Two ehcache.xml and save them in the lib folder of each tomcat. In the ehcache file I declared 3 caches:

> defaultCache
> org.hibernate.cache.StandardQueryCache
> org.hibernate.cache.UpdateTimestampsCache

Each cache has an RMI replicator. This is good but my question is whether I still have to declare my each in the ehcache.xml file A Grails domain class. If I do this, I will have the same declaration twice: one in ehcache.xml and the other in the class itself (I have set cache = true in the class);

< p>

class Book {
static mapping = {
...
cache true
}
}

Yes, you need to set it in two places. The ehcache.xml value configures the cache setting, but unless Enable caching for each domain class (and optional set of mappings), otherwise they will be ignored.

Usually, you won’t use the same settings in the defaultCache block because each domain Classes usually require different settings, for example

 maxElementsInMemory='1000'
eternal='true '
maxElementsOnDisk='0'>

class='net.sf.ehcache.distribution.RMICacheReplicatorFactory'
properties='replicateAsynchronously=false
replicatePutsViaCopy=false,
replicateUpdatesViaCopy=false,
replicatePuts=true,
replicateUpdates=true,
replicateRemovals=true'
/>

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2895 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.