package com.ccb.web.shiro;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
/**
* Redis初始化的时候清空用户信息
* 服务器宕机后,redis存储缓存信息与本地缓存不同步
*
* @author huan
* @version 2.8.2
* @Date 2019/8/13$
*/
@Component
@Slf4j
public class ShiroRedisCommandLineRunner implements CommandLineRunner {
@Autowired
RedisSessionDAO redisSessionDAO;
@Override
public void run(String... args) {
redisSessionDAO.clearCache();
log.info("redis缓存清除成功!");
}
}
记一下Shiro重构之ShiroRedisCommandLineRunner
最新推荐文章于 2020-03-22 22:12:11 发布