|
Hello, and thanks for this amazing crate! while let Some(mut page) = redis_client
.scan("*", Some(10), None)
.try_next()
.await
.unwrap()
{
if let Some(keys) = page.take_results() {
dbg!(keys);
}
page.next().unwrap();
}But if I extract let mut scan = redis_client.scan("*", Some(10), None);
while let Some(mut page) = scan.try_next().await.unwrap() {
if let Some(keys) = page.take_results() {
dbg!(keys);
}
page.next().unwrap();
} |
Answered by
aembke
Dec 19, 2023
Replies: 1 comment 1 reply
|
Hi @ghashy, SCAN works by repeatedly sending a In the first example you're sending a new |
1 reply
Answer selected by
39george
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @ghashy,
SCAN works by repeatedly sending a
SCAN <cursor> ...command to the server with an updated cursor after each page.In the first example you're sending a new
SCAN 0 ...call with a fresh starting cursor on each iteration in the while loop, and the second one is properly paging through the results. Or in other words - in the first example you're calling bothscanandtry_nexton each loop iteration, but in the second you're only callingtry_nexton each iteration.