jar包
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
application-pro.yml配置
启动项目 一主两从 出现红色箭头这个说明ok了 宕机主节点 控制台会实时监听主从节点切换日志
接口存入key 能存入成功就ok
@Autowired
private RedisCache redisCache;
@RequestMapping("/test")
public void test() {
redisCache.setCacheObject("静静", "wushunjie");
System.out.println();
}