Actions35
- Append
- Blocking Pop Left
- Blocking Pop Right
- Delete
- Eval
- Exists
- Expire At
- Get
- Get Set
- Hash Exists
- Hash Keys
- Hash Length
- Hash Values
- Increment
- Info
- Keys
- List Length
- Multi Get
- Multi Set
- Persist
- Pop
- Publish
- Push
- Scan
- Set
- Set Add
- Set Cardinality
- Set Is Member
- Set Remove
- Sorted Set Add
- Sorted Set Cardinality
- Sorted Set Range
- Sorted Set Remove
- String Length
- TTL
Overview
The node "Redis Enhanced" provides a comprehensive interface to interact with a Redis database, supporting a wide range of Redis operations. The "Scan" operation specifically allows incremental iteration over keys in the Redis store, which is useful for safely retrieving large sets of keys without blocking the server or client.
Common scenarios where the Scan operation is beneficial include:
- Efficiently listing keys matching a pattern in a production environment.
- Paginating through keys when the total number is large.
- Avoiding performance issues caused by commands that return all keys at once.
For example, you might use the Scan operation to find all keys starting with "user:" and process them in batches of 10, using the cursor to continue scanning from where the last batch ended.
Properties
| Name | Meaning |
|---|---|
| Cursor | Cursor position for scanning; start with 0 to begin a new scan cycle |
| Pattern | Pattern to match keys against (e.g., * for all keys, user:* for keys starting with "user:") |
| Count | Approximate number of keys to return per scan call |
Output
The output JSON object contains two fields:
cursor: A number representing the next cursor position to be used for continuing the scan. When this value returns to 0, the scan is complete.keys: An array of strings containing the keys matched in the current scan iteration.
Example output JSON:
{
"cursor": 1234,
"keys": ["user:1", "user:2", "session:abc"]
}
This structure allows iterative fetching of keys in manageable chunks.
Dependencies
- Requires a Redis instance accessible via credentials configured in n8n.
- Needs an API key or authentication token for connecting to the Redis server.
- Uses the Redis client library internally to perform operations.
Troubleshooting
- Connection errors: Ensure Redis credentials are correct and the Redis server is reachable.
- Invalid cursor: Cursor must be a non-negative integer; start with 0 for a fresh scan.
- Pattern syntax: Patterns must follow Redis glob-style patterns; invalid patterns may cause no results.
- Count parameter: This is a hint to Redis and not guaranteed; actual returned keys count may vary.
- If the node throws errors during execution, enabling "Continue On Fail" can help process other items while logging errors.
Links and References
- Redis SCAN command documentation
- Redis key patterns
- n8n Documentation on Redis nodes (general Redis usage)