Ehcache.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ehcache>
<!--缓存在硬盘中的位置 当二级缓存的对象超过内存限制时(缓存对象的个数>maxElementsInMemory) -->
<diskStore path="E:\Ehcache"/>
<!--
maxElementsInMemory:设置在内存中缓存对象的个数
maxElementsOnDisk:设置在硬盘中缓存对象的个数
eternal:设置缓存是否永不过期
overflowToDisk:当内存中缓存的对象个数超过maxElementsInMemory时,是否转移到硬盘
timeToIdleSeconds:当两次访问时间间隔超过该值时,使该缓存对象失效
timeToLiveSeconds:一个缓存对象最多存放的时间
diskExpiryThreadInternalSeconds:设置每隔多长时间,通过一个线程来清理硬盘中的缓存
memoryStoreEvictionPolicy:当超过缓存对象最大限制时,处理策略:LRU,FIFO,LFU(类似操作系统中的页面置换算法)
-->
<defaultCache>
maxElementsInMemory="1000"
maxElementsOnDisk="1000000"
eternal="false"
overflowToDisk="false"
timeToIdleSeconds="100"
timeToLiveSeconds="100"
diskExpiryThreadInternalSeconds="120"
memoryStoreEvictionPolicy="LRU"
</defaultCache>
</ehcache>