pom文件
<dependency>
<groupId>org
.springframework
.boot
</groupId
>
<artifactId>spring
-boot
-starter
-data
-redis
</artifactId
>
</dependency
>
代码
@Autowired
private StringRedisTemplate template
;
@Test
public void testValue(){
template
.opsForValue().set("zsj","name");
String zsj
= template
.opsForValue().get("zsj");
System
.out
.println(zsj
);
}
@Test
public void testRedis() {
template
.opsForHash().put("user","name","zsj");
Object o
= template
.opsForHash().get("user", "name");
System
.out
.println(o
);
}
转载请注明原文地址: https://mac.8miu.com/read-488462.html