refactor: 移除 Ehcache,默认缓存设置为 Redis

This commit is contained in:
xiongxiaoyang
2023-04-14 10:40:54 +08:00
parent 282bc7b707
commit 29d074ec18
11 changed files with 56 additions and 288 deletions

View File

@ -1,30 +0,0 @@
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd">
<!--timeToIdleSeconds 当缓存闲置n秒后销毁 -->
<!--timeToLiveSeconds 当缓存存活n秒后销毁 -->
<!-- 缓存配置 name:缓存名称 maxElementsInMemory缓存最大个数 eternal:对象是否永久有效一但设置了timeout将不起作用
timeToIdleSeconds设置对象在失效前的允许闲置时间单位仅当eternal=false对象不是永久有效时使用可选属性默认值是0也就是可闲置时间无穷大
timeToLiveSeconds设置对象在失效前允许存活时间单位最大时间介于创建时间和失效时间之间仅当eternal=false对象不是永久有效时使用默认是0.也就是对象存活时间无穷大
overflowToDisk当内存中对象数量达到maxElementsInMemory时Ehcache将会对象写到磁盘中 diskSpoolBufferSizeMB这个参数设置DiskStore磁盘缓存的缓存区大小默认是30MB每个Cache都应该有自己的一个缓冲区
maxElementsOnDisk硬盘最大缓存个数 diskPersistent是否缓存虚拟机重启期数据 Whether the disk
store persists between restarts of the Virtual Machine. The default value
is false. diskExpiryThreadIntervalSeconds磁盘失效线程运行时间间隔默认是120秒 memoryStoreEvictionPolicy当达到maxElementsInMemory限制时Ehcache将会根据指定的策略去清理内存默认策略是
LRU最近最少使用你可以设置为FIFO先进先出或是LFU较少使用 clearOnFlush内存数量最大时是否清除 maxEntriesLocalHeap="1000"
: 堆内存中最大缓存对象数,0没有限制(必须设置) maxEntriesLocalDisk="1000" : 硬盘最大缓存个数 -->
<!-- 磁盘缓存位置 -->
<diskStore path="user.dir/cachedata" />
<!-- 默认缓存 -->
<defaultCache maxElementsInMemory="10000" eternal="false"
timeToIdleSeconds="120" timeToLiveSeconds="120"
maxElementsOnDisk="10000000" diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU">
<persistence strategy="localTempSwap" />
</defaultCache>
<cache name="util_cache" maxEntriesLocalHeap="0" eternal="true"
overflowToDisk="true" diskPersistent="true" />
</ehcache>