Package io.lettuce.core
Class ScanStream
- java.lang.Object
-
- io.lettuce.core.ScanStream
-
public abstract class ScanStream extends Object
Scan command support exposed throughFlux
.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
All Methods Static Methods Concrete Methods 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 Detail
-
scan
public static <K,V> Flux<K> scan(RedisKeyReactiveCommands<K,V> commands)
Sequentially iterate over keys in the keyspace. This method usesSCAN
to 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
public static <K,V> Flux<K> scan(RedisKeyReactiveCommands<K,V> commands, ScanArgs scanArgs)
Sequentially iterate over keys in the keyspace. This method usesSCAN
to 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
public static <K,V> Flux<KeyValue<K,V>> hscan(RedisHashReactiveCommands<K,V> commands, K key)
Sequentially iterate over entries in a hash identified bykey
. This method usesHSCAN
to 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 usesHSCAN
to 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
public static <K,V> Flux<V> sscan(RedisSetReactiveCommands<K,V> commands, K key)
Sequentially iterate over elements in a set identified bykey
. This method usesSSCAN
to 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 usesSSCAN
to 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 usesSSCAN
to 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 usesSSCAN
to 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
.
-
-