您的位置:首页 > 其它

ehcache.xml详解

2015-09-28 16:44 288 查看
<?xml version="1.0" encoding="UTF-8"?>
<ehcache>
<!-- Sets the path to the directory where cache .data files are created.
设置缓存文件被创建的目录路径
If the path is a Java System Property it is replaced by
its value in the running VM.
如果这个路径是Java System Property,那么这个路径就会被这个属性值所替代
The following properties are translated:
user.home - User's home directory
user.dir - User's current working directory
java.io.tmpdir - Default temp file path -->

<!--Default Cache configuration. These will applied to caches programmatically created through
the CacheManager.

The following attributes are required:

maxElementsInMemory            - Sets the maximum number of objects that will be created in memory
设置内存中创建的最大对象个数
eternal                                     - Sets whether elements are eternal. If eternal,  timeouts are ignored and the element is never expired.
设置元素是否永恒,如果永恒,那么将忽略超时限制并且该元素永远不会过期
overflowToDisk                      - Sets whether elements can overflow to disk when the in-memory cache has reached the maxInMemory limit.
设置在内存中的缓存达到打到最大的对象数时是否允许溢出到磁盘

The following attributes are optional:
timeToIdleSeconds            -     Sets the time to idle for an element before it expires.
设置元素过期之前的空闲时间
i.e. The maximum amount of time between accesses before an
element expires Is only used if the element is not eternal.
Optional attribute. A value of 0 means that an Element can idle
for infinity.The default value is 0.
timeToLiveSeconds              - Sets the time to live for an element before it expires.
设置元素过期之前的时间
i.e. The maximum time between creation time and when an element
expires.  Is only used if the element is not eternal.
Optional attribute. A value of 0 means that and Element can live
for infinity.
The default value is 0.
diskPersistent                           - Whether the disk store persists between restarts of the Virtual Machine.
在重启虚拟机后磁盘存储是否还存在
The default value is false.
diskExpiryThreadIntervalSeconds   - The number of seconds between runs of the disk expiry thread.
磁盘失效线程之间的运行秒数。
The default value  is 120 seconds.
-->
<diskStore path="/data/ehcache"/>
<defaultCache maxElementsInMemory="10000" eternal="false"
overflowToDisk="true" timeToIdleSeconds="120" timeToLiveSeconds="180"
diskPersistent="false" diskExpiryThreadIntervalSeconds="60" />
<cache name="org.hibernate.cache.StandardQueryCache"
maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="300"
timeToLiveSeconds="4200" overflowToDisk="true" />
<cache name="org.hibernate.cache.UpdateTimestampsCache"
maxElementsInMemory="5000" eternal="true" timeToIdleSeconds="0"
timeToLiveSeconds="0" overflowToDisk="false" />
</ehcache>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: