hibernate+ehcache 集群配置

经常在黑云中出没 经常在黑云中出没 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
照着网上的方法,配了一下ehcache的集群。但发现,不起效果。改了一边,另外一台服务器上的缓存没改。

我贴一下配置。帮我看下什么问题,还是说因为我这个cache name,直接对应了一个实体,是不行的,需要实体里,再去写缓存处理的代码。rmiUrls里要指定缓存名称,那么defaultCache的怎么办。


<?xml version="1.0"?>
<ehcache updateCheck="false" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../config/ehcache.xsd">
<diskStore path="java.io.tmpdir" />
<cache name="com.wxbusiness.entities.Distributor" maxElementsInMemory="3000" eternal="false"
timeToIdleSeconds="3600" timeToLiveSeconds="7200" overflowToDisk="true"
maxElementsOnDisk="10000" diskPersistent="false"
diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=true,
replicatePuts=true, replicateUpdates=true,replicateUpdatesViaCopy=false,
replicateRemovals=true "/>
<bootstrapCacheLoaderFactory
class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"/>
</cache>
<defaultCache name="dCache" maxElementsInMemory="1000" eternal="false"
timeToIdleSeconds="3600" timeToLiveSeconds="3600" overflowToDisk="false"
maxElementsOnDisk="10000" diskPersistent="false"
diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU" >
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=true,
replicatePuts=true, replicateUpdates=true,replicateUpdatesViaCopy=false,
replicateRemovals=true "/>
<bootstrapCacheLoaderFactory
class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"/>
</defaultCache>
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="
socketTimeoutMillis=2000,
peerDiscovery=manual,
rmiUrls=//192.168.1.104:40002/com.wxbusiness.entities.Distributor|//192.168.1.104:40002/dCache"
/>
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostName=192.168.1.104,port=40001,socketTimeoutMillis=120000"/>

</ehcache>
...全文
评论 24
收藏 已收藏
分享
返回顶部
经常在黑云中出没
Java EE 67,535 成员 225,843 内容