知识扩展
ehcache是一个由java实现的轻量级的缓存工具包,提供内存和磁盘的存贮,支持分布式,多种淘汰算法,LRU,LFU,FIFO,可以与很多框架整合。
使用步骤:
1.添加依赖
net.sf.ehcache
ehcache
1.2.3
2.添加ehcahe.xml
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
updateCheck="false">
eternal="false"
maxElementsInMemory="10000"
overflowToDisk="false"
diskPersistent="false"
timeToIdleSeconds="1800"
timeToLiveSeconds="259200"
memoryStoreEvictionPolicy="LRU"/>
name="cloud_user"
eternal="false"
maxElementsInMemory="5000"
overflowToDisk="false"
diskPersistent="false"
timeToIdleSeconds="1800"
timeToLiveSeconds="1800"
memoryStoreEvictionPolicy="LRU"/>
from lj 2020.09.04