下面是实现一个Ehcache集群的最小配置:
<cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=automatic,
multicastGroupAddress=230.0.0.1,
multicastGroupPort=4446"/>
<cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"/>在缓存里添加下面的配置:
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/>
就像下面这个配置:
<cache name="sampleDistributedCache1"
maxEntriesLocalHeap="10"
eternal="false"
timeToIdleSeconds="100"
timeToLiveSeconds="100">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/>
</cache>集群里的每个缓存节点都要有上面的配置。
本文介绍了一个简单的Ehcache集群配置实例,通过设置缓存管理器的监听器和提供者来实现缓存集群,详细展示了如何配置缓存节点以便进行数据复制。
569

被折叠的 条评论
为什么被折叠?



