Redis Enhanced icon

Redis Enhanced

Get, send and update data in Redis with enhanced operations

Overview

The "Redis Enhanced" node provides a comprehensive interface to interact with a Redis database, supporting a wide range of Redis operations. The "Sorted Set Add" operation specifically allows users to add members with associated scores to a sorted set in Redis. This is useful for scenarios where you want to maintain an ordered collection of elements, such as leaderboards, priority queues, or time-series data.

For example, you can add multiple score-member pairs like 1.0 member1 2.0 member2 to a sorted set, and Redis will store them sorted by their scores. This enables efficient retrieval of elements based on their ranking or score.

Properties

Name Meaning
Sorted Set The name of the sorted set in Redis where the 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 if key type is hash) Whether the value is JSON or key-value pairs (not used in this operation).

Output

The output JSON contains information about the operation result:

  • sortedSet: The name of the sorted set to which members were added.
  • added: The number of new members that were added to the sorted set.
  • members: An array of objects representing the score-member pairs added, each with:
    • score: The numeric score of 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" }
  ]
}

Dependencies

  • Requires a Redis server connection configured via an API key credential or equivalent authentication.
  • The node uses a Redis client library internally to communicate with the Redis instance.
  • Proper Redis credentials must be provided in n8n for the node to connect successfully.

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 you provide pairs in the format score1 member1 score2 member2.
  • Connection errors: If the node cannot connect to Redis, verify the credentials and network connectivity.
  • Invalid score values: Scores must be valid floating-point numbers. Non-numeric scores will cause errors.
  • Continue on fail: If enabled, the node will continue processing other items even if one fails; otherwise, it will stop execution on the first error.

Links and References

Discussion