1.6K Star 17.2K Fork 14K

若依 / RuoYi-Cloud

 / 详情

我新增的org.springframework.cache.CacheManagerCacheManager没有实例、没有实现类,导致空指针

已完成
成员
创建于  
2020-06-11 17:21
//    @Autowired
    private CacheManager cacheManager;
// 清空缓存
cacheManager.getCache(CacheConstants.CLIENT_DETAILS_KEY).evict(auth2Authentication.getName());

请问,怎么实现CacheManager ?
下述代码行吗?使用redis进行存储操作:

    @Bean
    public CacheManager redisCacheManager() {
        RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate());
        //默认300秒过期
        cacheManager.setDefaultExpiration(Constants.Expiration);
        // 启动时加载远程缓存
        cacheManager.setLoadRemoteCachesOnStartup(true);
        //是否使用前缀生成器
        cacheManager.setUsePrefix(true);

        return cacheManager;
    }

评论 (1)

展开全部操作日志

这种和框架无关的内容建议自行网上查询资料。

若依 任务状态待办的 修改为已完成

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
1151004 y project 1578942802 2034498 dearvip 1578964735
Java
1
https://gitee.com/y_project/RuoYi-Cloud.git
git@gitee.com:y_project/RuoYi-Cloud.git
y_project
RuoYi-Cloud
RuoYi-Cloud

搜索帮助