项目中我是把ehcache 作为hibernate的二级缓存使用。
我有两个服务器,并且用apache 集群。
我的ehcache配置。<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd">
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
multicastGroupPort=4446, timeToLive=32"
/>
<cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" />
<diskStore path="java.io.tmpdir" />
<defaultCache maxElementsInMemory="10000" eternal="true"
timeToIdleSeconds="10000" timeToLiveSeconds="10000" overflowToDisk="true"
diskSpoolBufferSizeMB="3000" maxElementsOnDisk="10000000"
diskPersistent="false" diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU" /> <cache name="myCache2"
maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="100000"
timeToLiveSeconds="100000" overflowToDisk="true" >
<cacheEventListenerFactory
class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true,
replicateUpdates=true, replicateUpdatesViaCopy=false,
replicateRemovals=true"/>
</cache>
</ehcache>缓存不同步,手动的我也按照官方的配置去搞过,也不同步。
请高手指点或者发个配置好的可以同步的。
我有两个服务器,并且用apache 集群。
我的ehcache配置。<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd">
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
multicastGroupPort=4446, timeToLive=32"
/>
<cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" />
<diskStore path="java.io.tmpdir" />
<defaultCache maxElementsInMemory="10000" eternal="true"
timeToIdleSeconds="10000" timeToLiveSeconds="10000" overflowToDisk="true"
diskSpoolBufferSizeMB="3000" maxElementsOnDisk="10000000"
diskPersistent="false" diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU" /> <cache name="myCache2"
maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="100000"
timeToLiveSeconds="100000" overflowToDisk="true" >
<cacheEventListenerFactory
class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true,
replicateUpdates=true, replicateUpdatesViaCopy=false,
replicateRemovals=true"/>
</cache>
</ehcache>缓存不同步,手动的我也按照官方的配置去搞过,也不同步。
请高手指点或者发个配置好的可以同步的。
解决方案 »
- 请各位大虾们看看这个是哪有错误。
- Hibernate保存数据时,自动清除了数据库中所有的记录
- 菜鸟的一个javascript调用问题,大虾们来帮忙~
- 一个棘手的问题,望高手指点迷津
- 我是初学者,请教数据库的问题!
- 如何设置jsp服务器的环境
- javaBean的问题,请帮一下忙
- jsp程序员QQ联盟录
- 高分求救,请高手指教,为什么在JSP中用javamail API发送邮件总出现连接超时错误,急死人!
- 无论我将exportDataType设置为basic、selected、还是all,只是将当前页面的数据导入到Excel中,求大神解答?
- 万能的CSDN告诉我答案吧 - 百度是怎么做到的?
- 想在javaBean中写个方法实现教室是否可用的验证,请问怎么写?
同意,二级缓存即SESSION缓存,缓存不同,必定SESSION不同。集群不清楚怎么配置的,也不能提出什么解决方案了。
是集群的缓存不同步。
我在server1 上读取数据加入缓存后
server2 访问时还是去数据库查询。