/** * Use a {@link Cursor} to iterate over keys stored at the given {@link RedisClusterNode}. * * @param node must not be {@literal null}. * @param options must not be {@literal null}. * @return never {@literal null}. * @since 2.1 */ Cursor<byte[]> scan(RedisClusterNode node, ScanOptions options) { Assert.notNull(node, "RedisClusterNode must not be null!"); Assert.notNull(options, "Options must not be null!"); return connection.getClusterCommandExecutor() .executeCommandOnSingleNode((JedisClusterCommandCallback<Cursor<byte[]>>) client -> { return new ScanCursor<byte[]>(0, options) { @Override protected ScanIteration<byte[]> doScan(long cursorId, ScanOptions options) { ScanParams params = JedisConverters.toScanParams(options); redis.clients.jedis.ScanResult<String> result = client.scan(Long.toString(cursorId), params); return new ScanIteration<>(Long.valueOf(result.getCursor()), JedisConverters.stringListToByteList().convert(result.getResult())); } }.open(); }, node).getValue(); }
/** * Use a {@link Cursor} to iterate over keys stored at the given {@link RedisClusterNode}. * * @param node must not be {@literal null}. * @param options must not be {@literal null}. * @return never {@literal null}. * @since 2.1 */ Cursor<byte[]> scan(RedisClusterNode node, ScanOptions options) { Assert.notNull(node, "RedisClusterNode must not be null!"); Assert.notNull(options, "Options must not be null!"); return connection.getClusterCommandExecutor() .executeCommandOnSingleNode((JedisClusterCommandCallback<Cursor<byte[]>>) client -> { return new ScanCursor<byte[]>(0, options) { @Override protected ScanIteration<byte[]> doScan(long cursorId, ScanOptions options) { ScanParams params = JedisConverters.toScanParams(options); redis.clients.jedis.ScanResult<String> result = client.scan(Long.toString(cursorId), params); return new ScanIteration<>(Long.valueOf(result.getStringCursor()), JedisConverters.stringListToByteList().convert(result.getResult())); } }.open(); }, node).getValue(); }
/** * Use a {@link Cursor} to iterate over keys stored at the given {@link RedisClusterNode}. * * @param node must not be {@literal null}. * @param options must not be {@literal null}. * @return never {@literal null}. * @since 2.1 */ Cursor<byte[]> scan(RedisClusterNode node, ScanOptions options) { Assert.notNull(node, "RedisClusterNode must not be null!"); Assert.notNull(options, "Options must not be null!"); return connection.getClusterCommandExecutor() .executeCommandOnSingleNode((JedisClusterCommandCallback<Cursor<byte[]>>) client -> { return new ScanCursor<byte[]>(0, options) { @Override protected ScanIteration<byte[]> doScan(long cursorId, ScanOptions options) { ScanParams params = JedisConverters.toScanParams(options); redis.clients.jedis.ScanResult<String> result = client.scan(Long.toString(cursorId), params); return new ScanIteration<>(Long.valueOf(result.getStringCursor()), JedisConverters.stringListToByteList().convert(result.getResult())); } }.open(); }, node).getValue(); }