Related Documentation : Ehcache Replication Guide : Replicated Caching Using JGroups : Configuring CacheReplicators
Configuring CacheReplicators
Each cache that will be replicated needs to set a cache event listener which then replicates messages to the other CacheManager peers. This is done by adding a cacheEventListenerFactory element to each cache's configuration. The properties are identical to the one used for RMI replication. The listener factory must be of type JGroupsCacheReplicatorFactory.
<!-- Sample cache named sampleCache2. -->
<cache name="sampleCache2"
maxEntriesLocalHeap="10"
eternal="false"
timeToIdleSeconds="100"
timeToLiveSeconds="100"
overflowToDisk="false">
<cacheEventListenerFactory
class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true,
replicateUpdates=true, replicateUpdatesViaCopy=false, replicateRemovals=true" />
</cache>
The configuration options are explained below:
class - use net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory
The factory recognizes the following properties:
*replicatePuts=true | false - whether new elements placed in a cache are replicated to others. Defaults to true.
*replicateUpdates=true | false - whether new elements which override an element already existing with the same key are replicated. Defaults to true.
*replicateRemovals=true - whether element removals are replicated. Defaults to true.
*replicateAsynchronously=true | false - whether replications are asyncrhonous (true) or synchronous (false). Defaults to true.
*replicateUpdatesViaCopy=true | false - whether the new elements are copied to other caches (true), or whether a remove message is sent. Defaults to true.
*asynchronousReplicationIntervalMillis default 1000ms Time between updates when replication is asynchronous.
Copyright © 2010-2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product Logo |   Feedback