scan_all_keys
Scan and retrieve all keys matching a specified pattern in Redis using multiple SCAN iterations. Safely handles large datasets by avoiding KEYS * but may consume significant memory for extensive databases.
Instructions
Scan and return ALL keys matching a pattern using multiple SCAN iterations.
This function automatically handles the SCAN cursor iteration to collect all matching keys. It's safer than KEYS * for large databases but will still collect all results in memory.
⚠️ WARNING: With very large datasets (millions of keys), this may consume significant memory. For large-scale operations, consider using scan_keys() with manual iteration instead.
Args: pattern: Pattern to match keys against (default is "*" for all keys). batch_size: Number of keys to scan per iteration (default 100).
Returns: A list of all keys matching the pattern or an error message.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
batch_size | No | ||
pattern | No | * |