何时在EHCACHE中激活overFlowToDisk? [英] When overFlowToDisk gets activated in EHCACHE?

查看:104
本文介绍了何时在EHCACHE中激活overFlowToDisk?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对元素的 overflowToDisk属性有疑问吗?

I have some questions on "overflowToDisk" attribute of element?

1)我在此 URL

overflowToDisk设置当内存存储达到最大限制时元素是否可以溢出到磁盘。

overflowToDisk sets whether element can overflow to disk when the memory store has reached the maximum limit.

上面的内存是指为运行EHCACHE的Java进程分配的JVM内存,或者是否有任何参数指定高速缓存的内存大小?

"Memory" above refers JVM memory allocated for Java process running EHCACHE, or is there any parameter in to specify Cache memory size?

2)当运行EHCACHE的位置因某种原因终止时,是否清除了该磁盘并且缓存中的所有内容都消失了?

2) When the poces running EHCACHE terminates for some reason, whether this disk gets cleared and everything in cache gets vanished?

推荐答案

元素在内存存储中有超过 maxElementsInMemory 个时,就会开始溢出到磁盘。下面的示例创建一个高速缓存,该高速缓存将1000个元素存储在内存中,如果需要存储更多,则最多可在磁盘上存储10000个元素:

Elements start to overflow to the disk when you have more than maxElementsInMemory of them in the memory store. The following example creates a cache that stores 1000 elements in memory, and, if you need to store more, up to 10000 on disk:

<cache name="cacheName"
       maxElementsInMemory="1000"
       maxElementsOnDisk="10000"
       overflowToDisk="true"
       timeToIdleSeconds="..."
       timeToLiveSeconds="...">
</cache>

对于第二个问题,请查看 diskPersistent 参数。如果将其设置为true,则当您停止JVM时,Ehcache会将您的数据存储在磁盘上。下面的示例演示了这一点:

For the second question, have a look at the diskPersistent parameter. If it is set to true, Ehcache will keep your data stored on the disk when you stop the JVM. The following example demonstrates this:

<cache name="cacheName"
       maxElementsInMemory="1000"
       maxElementsOnDisk="10000"
       overflowToDisk="true"
       diskPersistent="true"
       timeToIdleSeconds="..."
       timeToLiveSeconds="...">
</cache>

这篇关于何时在EHCACHE中激活overFlowToDisk?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆