【发布时间】:2016-04-25 21:19:28
【问题描述】:
template.setEnableTransactionSupport(true);
template.multi();
template.opsForValue().set("mykey", "Hello World");
List<String> dataList = template.opsForList().range("mylist", 0, -1);
template.exec();
大家好。 我的 redis 中有一个名为“mylist”的列表,其大小为 50。
但是当我运行这段代码时,我无法得到我想要的。
“dataList”字段为空,但是,值为“Hello World”的“mykey”已在我的 redis 中持续存在。
那么如何在 spring-data-redis 事务中获取我的列表数据?非常感谢。
【问题讨论】: