Actions37
- Append
- Blocking Pop Left
- Blocking Pop Right
- Delete
- Eval
- Exists
- Expire
- 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 Members
- Set Remove
- Sorted Set Add
- Sorted Set Cardinality
- Sorted Set Range
- Sorted Set Remove
- String Length
- TTL
Overview
The "Redis Enhanced" node provides a comprehensive interface to interact with a Redis database, supporting a wide range of operations on different Redis data types such as strings, hashes, lists, sets, and sorted sets. It allows users to get, set, update, delete, and query data in Redis with enhanced capabilities including atomic increments, Lua script execution, blocking list pops, and more.
This node is beneficial in scenarios where you need to integrate Redis caching, messaging, or data storage into your workflows. For example:
- Retrieving a range of members from a sorted set for leaderboard display.
- Adding or removing members from sorted sets or sets.
- Executing Lua scripts for complex Redis transactions.
- Managing key expiration and persistence.
- Publishing messages to Redis channels for real-time notifications.
Specifically, the "Sorted Set Range" operation fetches a range of members from a sorted set, optionally including their scores, which is useful for ranking systems, time-series data retrieval, or any scenario requiring ordered data access.
Properties
| Name | Meaning |
|---|---|
| Sorted Set | The name of the sorted set in Redis to operate on. |
| Start | The start index (inclusive) of the range to retrieve from the sorted set. |
| Stop | The stop index (inclusive) of the range to retrieve; -1 means the end of the sorted set. |
| With Scores | Boolean flag indicating whether to include the scores of the members in the output result. |
| Value Is JSON | (Shown only if key type is hash) Whether the value is JSON or key-value pairs. |
Output
The output is an array of JSON objects, each representing the result of the operation for one input item.
For the "Sorted Set Range" operation, the output JSON has the following structure:
{
"sortedSet": "name_of_sorted_set",
"result": [
"member1",
"member2",
...
]
}
If the "With Scores" option is enabled, the result array contains objects with both member values and their scores, e.g.:
[
{ "value": "member1", "score": 1.0 },
{ "value": "member2", "score": 2.0 }
]
This output allows downstream nodes to process the retrieved sorted set members and their associated scores.
Dependencies
- Requires a Redis server 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.
- No additional external services are required beyond Redis itself.
Troubleshooting
- Connection Issues: If the node cannot connect to Redis, verify that the Redis server is running, reachable, and credentials are correct.
- Invalid Parameters: Ensure that the sorted set name exists and indices (
start,stop) are within valid ranges. - Score-Member Pair Errors: When adding members to sorted sets, ensure score-member pairs are provided in even numbers.
- JSON Parsing Errors: If using JSON values in hashes, malformed JSON strings may cause errors.
- Timeouts: Blocking pop operations may wait indefinitely if timeout is set to zero; adjust accordingly.
- Error Messages: Common error messages include connection failures, command syntax errors, or invalid key types. Review the error message for specifics and check Redis documentation for command usage.
Links and References
- Redis Sorted Sets Documentation
- Redis Commands Reference
- n8n Redis Node Documentation (for general Redis node usage)