配套资料,免费下载
链接:https://pan.baidu.com/s/1jA217UgqXpONi_fV-aOzqw
提取码:bm2g
复制这段内容后打开百度网盘手机App,操作更方便哦
注意:学习Redis请参考我的另外一篇文章:https://caochenlei.blog.csdn.net/article/details/108067929
1、创建工程
2、开启软件
下载配套资料,点击 startup.bat 启动软件即可。
3、修改配置
spring:
redis:
host: 127.0.0.1
port: 6379
password: 123456
4、测试操作
@SpringBoottest
class IntegrationRedisApplicationTests {
@Autowired
private Redistemplate<String, String> redistemplate;
@Test
@displayName("设置操作")
public void testSet() {
ValueOperations<String, String> operations = redistemplate.opsForValue();
operations.set("code", "741852963");
}
@Test
@displayName("获取操作")
public void testGet() {
ValueOperations<String, String> operations = redistemplate.opsForValue();
String code = operations.get("code");
System.out.println(code);
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。