一些字体图标库的网站 https://icomoon.io/app/#/selecthttp://www.iconfont.cn/http://www.bootcss.com/ http://www.
顺晟科技
2021-06-28 19:44:31
133
pom 引入依赖
<!-- Ehcache -->
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
2.resources 目录下直接放个文件 ehcache.xml
<ehcache xmlns:xsi="
xsi:noNamespaceSchemaLocation="
updateCheck="false">
<diskStore path="java.io.tmpdir"/>
<!--defaultCache:echcache的默认缓存策略 -->
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
maxElementsOnDisk="10000000"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU">
<persistence strategy="localTempSwap"/>
</defaultCache>
<!-- 菜单缓存策略 -->
<cache name="menucache"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
maxElementsOnDisk="10000000"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU">
<persistence strategy="localTempSwap"/>
</cache>
</ehcache>
3.在Service层 方法上加上注解
@CacheEvict(value="menucache", allEntries=true) ,更新页游缓存
@Cacheable(key="'menu-'+#parentId",value="menucache") 读取缓存, "'menu-'+#parentId" 通配符,也可以直接写死字符串
menucache 对应 上面 xml name="menucache"
/**删除菜单
@param MENU_ID@fhadmin.org@CacheEvict(value="menucwww.pizei.comache", allEntries=true)
public void deleteMenuById(String MENU_ID) throws Exception{
this.cleanRedis();
menuMapper.deleteMenuById(MENU_ID);
}
/**
@Cacheable(key="'menu-'+#parentId",value="menucache")
public List<Menu> listSubMenuByParentId(String parentId) throws Exception {
return menuMapper.listSubMenuByParentId(parentId);
}
13
2022-09
13
2022-09
15
2021-09
13
2021-09
13
2021-09
04
2021-09