Actions41
- Append
- Blocking Pop Left
- Blocking Pop Right
- Delete
- Eval
- Exists
- Expire At
- Get
- Get Set
- Hash Exists
- Hash Get
- Hash Keys
- Hash Length
- Hash Set
- Hash Values
- Increment
- Info
- Keys
- List Length
- List Range
- Multi Get
- Multi Hash Get
- Multi Mix Get
- Multi Mix Set
- 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 including string manipulation, list handling, set and sorted set management, hash operations, key scanning, and Lua script execution. The "Sorted Set Add" operation specifically allows users to add members with associated scores to a sorted set in Redis.
This node is beneficial in scenarios where you need to manage data structures in Redis efficiently, such as caching, leaderboard management, real-time analytics, or message queuing. For example, adding user scores to a game leaderboard can be done using the "Sorted Set Add" operation by specifying score-member pairs.
Properties
| Name | Meaning |
|---|---|
| Sorted Set | The name of the sorted set in Redis where members will be added. |
| Score-Member Pairs | Space-separated pairs of scores and members to add, e.g., 1.0 member1 2.0 member2. |
| Value Is JSON | (Shown only for hash key types) Whether the value is JSON or key-value pairs (not used here). |
Output
The output JSON object contains information about the sorted set operation performed:
sortedSet: The name of the sorted set.added: The number of new members added to the sorted set.members: An array of objects representing the score-member pairs added, each with:score: The numeric score assigned to the member.value: The member's value (string).
Example output:
{
"sortedSet": "mySortedSet",
"added": 2,
"members": [
{ "score": 1.0, "value": "member1" },
{ "score": 2.0, "value": "member2" }
]
}
The node does not output binary data for this operation.
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.
Troubleshooting
Error: "Score-member pairs must be even number of arguments"
This error occurs if the input string for score-member pairs does not contain an even number of elements (each score must have a corresponding member). Ensure the input format is correct, e.g.,"1.0 member1 2.0 member2".Connection errors
If the node cannot connect to Redis, verify that the Redis server is running, network connectivity is available, and credentials are correct.Invalid score values
Scores must be parseable as floating-point numbers. Non-numeric scores will cause errors.JSON parsing errors
Although not directly relevant for this operation, other operations may fail if JSON inputs are malformed.