Spring Boot 之Redis

Spring Boot对Redis操作进行了封装,其接口为Operations。

使用步骤:
1.增加依赖。(时间有点长)

org.springframework.boot
spring-boot-starter-data-redis

2.配置属性。(不配不影响使用)
3.配置Spring Boot提供的Redis的封装对象redisTemplate和Cache相关配置。
4.只在service层使用redisTemplate或者将redisTemplate方法封装成service类。

猜你喜欢

转载自www.cnblogs.com/zd540/p/11286559.html