我正在尝试使用RedisConnection执行“scan”命令。不明白为什么以下代码会抛出NoSuchElementException异常。
RedisConnection redisConnection = redisTemplate.getConnectionFactory().getConnection();
Cursor c = redisConnection.scan(scanOptions);
while (c.hasNext()) {
c.next();
}
异常:
java.util.NoSuchElementException 在 java.util.Collections$EmptyIterator.next(Collections.java:4189) 中 atorg.springframework.data.redis.core.ScanCursor.moveNext(ScanCursor.java:215)中 at org.springframework.data.redis.core.ScanCursor.next(ScanCursor.java:202)