Actions36
- 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
- List Range
- 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 operations such as scanning keys, setting and getting values, managing lists, sets, sorted sets, hashes, and executing Lua scripts. The "Scan" operation specifically allows incremental iteration over keys in the Redis store, which is useful for safely retrieving large numbers of keys without blocking the server.
Common scenarios where this node is beneficial include:
- Incrementally fetching keys matching a pattern from Redis for processing or monitoring.
- Implementing pagination or batch processing of Redis keys.
- Safely iterating over keys in production environments without causing performance issues.
Example use case:
- You want to retrieve all keys starting with "user:" but avoid blocking Redis by fetching them in small batches. Using the Scan operation with a cursor and pattern "user:*" lets you do this efficiently.
Properties
| Name | Meaning |
|---|---|
| Cursor | Cursor position for scanning; start with 0 to begin a new scan iteration. |
| Pattern | Pattern to match keys against (e.g., "" for all keys, "user:" for keys starting with "user:"). |
| Count | Approximate number of keys to return in one scan call; controls batch size. |
| Value Is JSON | (Shown only if key type is "hash") Whether the value stored is JSON or key-value pairs. |
Output
The output JSON object for the Scan operation contains two fields:
cursor: A number representing the next cursor position to continue scanning from. When it returns 0, the scan is complete.keys: An array of strings containing the keys matched by the scan operation in the current batch.
This structure allows iterative calls to the Scan operation using the returned cursor until all keys are retrieved.
No binary data output is produced by this operation.
Example output:
{
"cursor": 1234,
"keys": ["key1", "key2", "key3"]
}
Dependencies
- Requires a Redis instance accessible via credentials configured in n8n.
- Needs an API key credential or connection details for Redis authentication.
- Uses the Redis client library internally to perform commands.
Troubleshooting
- Common issues:
- Connection failures due to incorrect Redis credentials or network issues.
- Invalid cursor values may cause unexpected results; always start with cursor 0 for a new scan.
- Large count values might impact Redis performance; adjust count according to your environment.
- Error messages:
- Errors related to Redis connection will be thrown if credentials are invalid or Redis is unreachable.
- If the pattern syntax is invalid, Redis may return an error.
- Resolution:
- Verify Redis credentials and network connectivity.
- Use cursor 0 to start scanning.
- Use valid glob-style patterns for matching keys.
- Adjust count to balance between performance and batch size.
Links and References
- Redis SCAN command documentation
- Redis official website
- n8n Redis Enhanced node documentation (if available) (Note: link is illustrative)