java.lang.Object
io.lettuce.core.ScanStream
public abstract class ScanStream extends Object
Scan command support exposed through
Flux.
ScanStream uses reactive command interfaces to scan over keys (SCAN), sets (SSCAN), sorted sets (
ZSCAN), and hashes (HSCAN).
Use ScanArgs.limit(long) to set the batch size.
Data structure scanning is progressive and stateful and demand-aware. It supports full iterations (until all received cursors are exhausted) and premature termination. Subsequent scan commands to fetch the cursor data get only issued if the subscriber signals demand.
- Since:
- 5.1
- Author:
- Mark Paluch, Mikhael Sokolov
-
Method Summary
Modifier and Type Method Description static <K, V> Flux<KeyValue<K,V>>hscan(RedisHashReactiveCommands<K,V> commands, K key)Sequentially iterate over entries in a hash identified bykey.static <K, V> Flux<KeyValue<K,V>>hscan(RedisHashReactiveCommands<K,V> commands, K key, ScanArgs scanArgs)Sequentially iterate over entries in a hash identified bykey.static <K, V> Flux<K>scan(RedisKeyReactiveCommands<K,V> commands)Sequentially iterate over keys in the keyspace.static <K, V> Flux<K>scan(RedisKeyReactiveCommands<K,V> commands, ScanArgs scanArgs)Sequentially iterate over keys in the keyspace.static <K, V> Flux<V>sscan(RedisSetReactiveCommands<K,V> commands, K key)Sequentially iterate over elements in a set identified bykey.static <K, V> Flux<V>sscan(RedisSetReactiveCommands<K,V> commands, K key, ScanArgs scanArgs)Sequentially iterate over elements in a set identified bykey.static <K, V> Flux<ScoredValue<V>>zscan(RedisSortedSetReactiveCommands<K,V> commands, K key)Sequentially iterate over elements in a set identified bykey.static <K, V> Flux<ScoredValue<V>>zscan(RedisSortedSetReactiveCommands<K,V> commands, K key, ScanArgs scanArgs)Sequentially iterate over elements in a set identified bykey.
-
Method Details
-
scan
Sequentially iterate over keys in the keyspace. This method usesSCANto perform an iterative scan.- Type Parameters:
K- Key type.V- Value type.- Parameters:
commands- the commands interface, must not benull.- Returns:
- a new
Flux.
-
scan
Sequentially iterate over keys in the keyspace. This method usesSCANto perform an iterative scan.- Type Parameters:
K- Key type.V- Value type.- Parameters:
commands- the commands interface, must not benull.scanArgs- the scan arguments, must not benull.- Returns:
- a new
Flux.
-
hscan
Sequentially iterate over entries in a hash identified bykey. This method usesHSCANto perform an iterative scan.- Type Parameters:
K- Key type.V- Value type.- Parameters:
commands- the commands interface, must not benull.key- the hash to scan.- Returns:
- a new
Flux.
-
hscan
public static <K, V> Flux<KeyValue<K,V>> hscan(RedisHashReactiveCommands<K,V> commands, K key, ScanArgs scanArgs)Sequentially iterate over entries in a hash identified bykey. This method usesHSCANto perform an iterative scan.- Type Parameters:
K- Key type.V- Value type.- Parameters:
commands- the commands interface, must not benull.key- the hash to scan.scanArgs- the scan arguments, must not benull.- Returns:
- a new
Flux.
-
sscan
Sequentially iterate over elements in a set identified bykey. This method usesSSCANto perform an iterative scan.- Type Parameters:
K- Key type.V- Value type.- Parameters:
commands- the commands interface, must not benull.key- the set to scan.- Returns:
- a new
Flux.
-
sscan
public static <K, V> Flux<V> sscan(RedisSetReactiveCommands<K,V> commands, K key, ScanArgs scanArgs)Sequentially iterate over elements in a set identified bykey. This method usesSSCANto perform an iterative scan.- Type Parameters:
K- Key type.V- Value type.- Parameters:
commands- the commands interface, must not benull.key- the set to scan.scanArgs- the scan arguments, must not benull.- Returns:
- a new
Flux.
-
zscan
public static <K, V> Flux<ScoredValue<V>> zscan(RedisSortedSetReactiveCommands<K,V> commands, K key)Sequentially iterate over elements in a set identified bykey. This method usesSSCANto perform an iterative scan.- Type Parameters:
K- Key type.V- Value type.- Parameters:
commands- the commands interface, must not benull.key- the sorted set to scan.- Returns:
- a new
Flux.
-
zscan
public static <K, V> Flux<ScoredValue<V>> zscan(RedisSortedSetReactiveCommands<K,V> commands, K key, ScanArgs scanArgs)Sequentially iterate over elements in a set identified bykey. This method usesSSCANto perform an iterative scan.- Type Parameters:
K- Key type.V- Value type.- Parameters:
commands- the commands interface, must not benull.key- the sorted set to scan.scanArgs- the scan arguments, must not benull.- Returns:
- a new
Flux.
-