Complete the code to start scanning keys from the beginning.
cursor = [1]The SCAN command starts with cursor 0 to begin iteration over keys.
Complete the code to scan keys matching the pattern 'user:*'.
cursor, keys = redis.scan(cursor, match=[1])The pattern 'user:*' matches keys starting with 'user:' followed by anything.
Fix the error in the loop condition to continue scanning until cursor is zero.
while cursor != [1]: cursor, keys = redis.scan(cursor)
The SCAN command returns cursor 0 when the iteration is complete.
Fill both blanks to scan keys with count 100 and match pattern 'session:*'.
cursor, keys = redis.scan(cursor, match=[1], count=[2])
Use match='session:*' to filter keys and count=100 to limit keys per scan.
Fill all three blanks to safely iterate all keys and collect them in a list.
all_keys = [] cursor = [1] while cursor != [2]: cursor, keys = redis.scan(cursor, match=[3]) all_keys.extend(keys)
Start cursor at 0, loop until cursor is 0, and match '*' to get all keys.
