scan_all_keys
Scan and retrieve all Redis keys matching a specified pattern using automated SCAN iterations. Safe for large datasets, though memory usage may increase with millions of keys. Adjust batch size for optimization.
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 | * |