https://spring.io/projects/spring-data-redis
- pom.xml引入spring-boot-starter-data-redis
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
- 配置文件
- 注入RedisTemplate使用
redisTemplate.opsForValue().set("code", codeStr);
redisTemplate.opsForValue().get("code")
- 一般不直接用RedisTemplate,而是进行封装redisTemplate.opsForValue()到redisService工具类中直接get/set得
- sdg
- fsdrg