ehcache配置
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="ehcache.xsd">
<!--
diskStore:配置缓存数据落地到磁盘,该配置要结合cache标签中的overflowToDisk和diskPersistent属性共同使用,
当overflowToDisk和diskPersistent属性值均为true时缓存数据才会落地到磁盘。
path的默认值是"java.io.tmpdir"
-->
<!-- <diskStore path="D:/code_bak"/> -->
<!-- <diskStore path="java.io.tmpdir"/> -->
<!--
缓存配置(可配置多个缓存):
maxElementsInMemory:【过时】,已经被maxEntriesLocalHeap属性代替。
maxEntriesLocalHeap:缓存中最多存放的对象的数量。
eternal:中文含义是"永恒的",值为true代表该缓存中的值永不过期。
timeToIdleSeconds:在一个元素过期之前,其最大的闲置时间(即最大的没有被访问的时间)。
timeToLiveSeconds:元素的存活时间(从创建到过期的时间间隔)。
memoryStoreEvictionPolicy:指定policy将会在maxEntriesLocalHeap值到达指定值时执行,清除缓存中长久不用的数据。
-->
<defaultCache maxEntriesLocalHeap="100" eternal="false"
timeToIdleSeconds="3600" timeToLiveSeconds="3600"
memoryStoreEvictionPolicy="LRU" overflowToDisk="false" diskPersistent="false" />
<cache name="sampleCache0" maxEntriesLocalHeap="100" eternal="false"
timeToIdleSeconds="3600" timeToLiveSeconds="3600"
memoryStoreEvictionPolicy="LRU" overflowToDisk="true" diskPersistent="true" />
<!--
<cache name="sampleCache1" maxEntriesLocalHeap="10000"
maxEntriesLocalDisk="1000" eternal="false" diskSpoolBufferSizeMB="20"
timeToIdleSeconds="300" timeToLiveSeconds="600"
memoryStoreEvictionPolicy="LFU" transactionalMode="off">
<persistence strategy="localTempSwap" />
</cache>
-->
<!--
<cache name="sampleCache2" maxEntriesLocalHeap="1000" eternal="true"
memoryStoreEvictionPolicy="FIFO" />
<cache name="sampleCache3" maxEntriesLocalHeap="500" eternal="false"
overflowToDisk="true" diskPersistent="true" timeToIdleSeconds="300"
timeToLiveSeconds="600" diskExpiryThreadIntervalSeconds="1"
memoryStoreEvictionPolicy="LFU"></cache>
<cache name="sampleTerracottaCache" maxBytesLocalHeap="10m"
eternal="false" timeToIdleSeconds="3600" timeToLiveSeconds="1800">
<terracotta />
</cache>
-->
</ehcache>
<!-- 参考资料:
1. http://www.ehcache.org/ehcache.xml
2. http://www.ehcache.org/generated/2.10.0/html/ehc-all/#page/Ehcache_Documentation_Set%2Fre-ehcache_reference_documentation.html%23
-->