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

sunchun122 发布于 2010/12/02 12:11
阅读 1K+
收藏 1

<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还可以使用缓存到磁盘里面的缓存数据而不是重新去访问网络得到数据。

请高手大哥们不吝赐教。

加载中
0
wad12302
wad12302
该评论暂时无法显示,详情咨询 QQ 群:点此入群
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部