关于Ehcache集群缓存在应用重启后的加载问题

9月22日(星期六下午)OSC源创会[西安] 正在报名

<diskStore path="java.io.tmpdir/ehcache" />

<defaultCache maxElementsInMemory="10000" eternal="true"
  overflowToDisk="true" timeToIdleSeconds="0" timeToLiveSeconds="0"
  diskPersistent="false" diskExpiryThreadIntervalSeconds="120">
  <cacheEventListenerFactory
   class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
   properties="replicateAsynchronously=true, replicatePuts=true,  
                 replicateUpdates=true, replicateUpdatesViaCopy=false, replicateRemovals=true" />
 </defaultCache>

 <cache name="mycache" maxElementsInMemory="10000" eternal="true"
  overflowToDisk="true" timeToIdleSeconds="0" timeToLiveSeconds="0"
  diskPersistent="false" diskExpiryThreadIntervalSeconds="120">
  <cacheEventListenerFactory
   class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
   properties="replicateAsynchronously=true, replicatePuts=true,  
                replicateUpdates=true, replicateUpdatesViaCopy=false, replicateRemovals=true" />
 </cache>
 

我的问题是:
1、这个问题是最重要的,按照我的配置,缓存的数据会被保存到.data文件里面,也就是保存到磁盘。那么我的问题就来了,为什么当我把应用重启后,ehcache不会去加载.data里面的内容,而是还要去访问网络?

我的最终目的是想要,当ehcache缓存了某些数据后到磁盘后,即使应用重启了(先关闭,后启动),ehcache还可以使用缓存到磁盘里面的缓存数据而不是重新去访问网络得到数据。

请高手大哥们不吝赐教。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值