Redis Enhanced icon

Redis Enhanced

Get, send and update data in Redis with enhanced operations

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, Lua script execution, and key management. It is designed for users who want to perform advanced Redis commands within n8n workflows without writing custom code.

For the Sorted Set Add operation specifically, the node allows adding members with associated scores to a sorted set in Redis. This is useful when you need to maintain an ordered collection of elements, such as leaderboards, priority queues, or time-series data.

Practical examples:

  • Adding user scores to a game leaderboard where each member is a player ID and the score represents their points.
  • Inserting timestamped events into a sorted set for efficient range queries by time.
  • Managing task priorities in a queue system where tasks are scored by urgency.

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 in the format: score1 member1 score2 member2. Each score must be a number, followed by its corresponding member string.

Output

The output JSON object contains information about the result of the add operation:

  • sortedSet: The name of the sorted set to which members were added.
  • added: The number of new members that were successfully added to the sorted set (excluding those whose score was updated).
  • members: An array of objects representing the added members, each with:
    • score: The numeric score assigned to the member.
    • value: The member's value (string).

Example output JSON:

{
  "sortedSet": "leaderboard",
  "added": 2,
  "members": [
    { "score": 1.0, "value": "member1" },
    { "score": 2.0, "value": "member2" }
  ]
}

Dependencies

  • Requires a Redis server accessible via credentials configured in n8n.
  • Needs an API key or authentication token for connecting to the Redis instance.
  • Uses the Redis client library internally to execute commands.
  • No additional external services are required beyond Redis itself.

Troubleshooting

  • 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 space-separated tokens. Ensure every score has a corresponding member.
  • Connection errors: If the node cannot connect to Redis, verify the credentials and network accessibility of the Redis server.
  • Invalid score values: Scores must be valid floating-point numbers. Non-numeric scores will cause errors.
  • Permission issues: Make sure the Redis user has permissions to modify the specified sorted set.
  • To resolve errors, check the node's error messages and ensure all inputs conform to expected formats.

Links and References

Discussion