【发布时间】:2015-10-20 15:26:48
【问题描述】:
我在我的服务器上使用 ehcache 作为热缓存。我希望它完全在内存中,并且只写入磁盘以保持持久性。从应用程序重新启动时重新加载。
我看到 ehcache 几乎在每个缓存上都写入磁盘。这是文档所说的
Operation of a Cache where overflowToDisk is false and diskPersistent is true
In this configuration case, the disk will be written on flush or shutdown.
The next time the cache is started, the disk store will initialise but will not permit overflow from the
MemoryStore. In all other respects it acts like a normal disk store.
但是,当我检查 /mnt/ehcache 时,我发现它在每次放置时都被写入。发生这种情况的任何原因?
这是我的缓存配置。
<diskStore path="/mnt/ehcache/" />
<cache
name="feedLocalCache"
maxEntriesLocalHeap="2000000"
eternal="false"
timeToLiveSeconds="1800"
timeToIdleSeconds="0"
diskPersistent="true"
overflowToDisk="false"
memoryStoreEvictionPolicy="LFU" >
<bootstrapCacheLoaderFactory class="net.sf.ehcache.store.DiskStoreBootstrapCacheLoaderFactory" properties="bootstrapAsynchronously=true"/>
【问题讨论】: