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 事务中获取我的列表数据呢?非常感谢。