关于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还可以使用缓存到磁盘里面的缓存数据而不是重新去访问网络得到数据。
请高手大哥们不吝赐教。