<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../config/ehcache.xsd">
<!--当二级缓存的对象 超过内存限制时(缓存对象的个数>maxElementsInMemory),存放入的硬盘文件 -->
<diskStore path="F:\Ehcache"/>
<!--
maxElementsInMemory:设置 在内存中缓存 对象的个数
maxElementsOnDisk:设置 在硬盘中缓存 对象的个数
eternal:设置缓存是否 永远不过期
overflowToDisk:当内存中缓存的对象个数 超过
maxElementsInMemory的时候,是否转移到硬盘中
timeToIdleSeconds:当2次访问 超过该值的时候,将缓存对象失效
timeToLiveSeconds:一个缓存对象 最多存放的时间(生命周期)
diskExpiryThreadIntervalSeconds:设置每隔多长时间,通过一个线程来清理硬盘中的缓存
memoryStoreEvictionPolicy:当超过缓存对象的最大值时,处理的策略;LRU,FIFO,LFU
-->
<defaultCache
maxElementsInMemory="1000"
maxElementsOnDisk="1000000"
eternal="false"
overflowToDisk="false"
timeToIdleSeconds="100"
timeToLiveSeconds="100"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU">
</defaultCache>
</ehcache>
【MyBatis】Ehcache配置文件
最新推荐文章于 2022-11-20 02:19:41 发布
本文详细介绍了如何在MyBatis中配置并使用Ehcache作为二级缓存,包括Ehcache的配置文件设置、MyBatis的XML配置以及在Mapper中的使用方法,帮助读者理解MyBatis与Ehcache的集成过程。
2万+

被折叠的 条评论
为什么被折叠?



