mirror of https://gitee.com/stylefeng/roses
【8.0】【sys】【role】更新自动配置
parent
5018af7786
commit
c30732b3ba
|
@ -29,6 +29,7 @@ import cn.hutool.cache.impl.TimedCache;
|
|||
import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
|
||||
import cn.stylefeng.roses.kernel.sys.api.constants.SysConstants;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.role.cache.rolemenu.RoleMenuMemoryCache;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.role.cache.roleoptions.RoleMenuOptionsMemoryCache;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
@ -58,4 +59,17 @@ public class RoleMemoryCacheAutoConfiguration {
|
|||
return new RoleMenuMemoryCache(cache);
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色绑定菜单功能的缓存
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/7/14 23:56
|
||||
*/
|
||||
@Bean
|
||||
public CacheOperatorApi<List<Long>> roleMenuOptionsCache() {
|
||||
// 1小时过期
|
||||
TimedCache<String, List<Long>> cache = CacheUtil.newTimedCache(1000 * SysConstants.DEFAULT_SYS_CACHE_TIMEOUT_SECONDS);
|
||||
return new RoleMenuOptionsMemoryCache(cache);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ package cn.stylefeng.roses.kernel.sys.starter.cache.role;
|
|||
import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
|
||||
import cn.stylefeng.roses.kernel.cache.redis.util.CreateRedisTemplateUtil;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.role.cache.rolemenu.RoleMenuRedisCache;
|
||||
import cn.stylefeng.roses.kernel.sys.modular.role.cache.roleoptions.RoleMenuOptionsRedisCache;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
@ -57,4 +58,16 @@ public class RoleRedisCacheAutoConfiguration {
|
|||
return new RoleMenuRedisCache(redisTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色绑定菜单功能的缓存
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/7/14 23:57
|
||||
*/
|
||||
@Bean
|
||||
public CacheOperatorApi<List<Long>> roleMenuOptionsCache(RedisConnectionFactory redisConnectionFactory) {
|
||||
RedisTemplate<String, List<Long>> redisTemplate = CreateRedisTemplateUtil.createObject(redisConnectionFactory);
|
||||
return new RoleMenuOptionsRedisCache(redisTemplate);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
cn.stylefeng.roses.kernel.sys.starter.config.RestErrorViewAutoConfiguration,\
|
||||
cn.stylefeng.roses.kernel.sys.starter.cache.theme.ThemeMemoryCacheAutoConfiguration,\
|
||||
cn.stylefeng.roses.kernel.sys.starter.cache.theme.ThemeRedisCacheAutoConfiguration,\
|
||||
cn.stylefeng.roses.kernel.sys.starter.cache.resource.ResourceMemoryCacheAutoConfiguration,\
|
||||
cn.stylefeng.roses.kernel.sys.starter.cache.resource.ResourceRedisCacheAutoConfiguration,\
|
||||
cn.stylefeng.roses.kernel.sys.starter.config.RestErrorViewAutoConfiguration,\
|
||||
cn.stylefeng.roses.kernel.sys.starter.cache.org.OrgMemoryCacheAutoConfiguration,\
|
||||
cn.stylefeng.roses.kernel.sys.starter.cache.org.OrgRedisCacheAutoConfiguration
|
||||
cn.stylefeng.roses.kernel.sys.starter.cache.org.OrgRedisCacheAutoConfiguration,\
|
||||
cn.stylefeng.roses.kernel.sys.starter.cache.user.UserMemoryCacheAutoConfiguration,\
|
||||
cn.stylefeng.roses.kernel.sys.starter.cache.user.UserRedisCacheAutoConfiguration,\
|
||||
cn.stylefeng.roses.kernel.sys.starter.cache.role.RoleMemoryCacheAutoConfiguration,\
|
||||
cn.stylefeng.roses.kernel.sys.starter.cache.role.RoleRedisCacheAutoConfiguration
|
||||
|
|
Loading…
Reference in New Issue