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, key scanning, and Lua script execution. It is designed for users who want to get, send, and update data in Redis with enhanced capabilities beyond basic commands.

A common use case is managing sorted sets in Redis, such as retrieving a range of members from a sorted set with optional scores, adding or removing members with associated scores, or getting the cardinality (number of members) of a sorted set. This is useful in scenarios like leaderboards, priority queues, or time-series data where elements are scored and ordered.

For example, using the "Sorted Set Range" operation, you can fetch a subset of members from a leaderboard stored as a sorted set, optionally including their scores to display rankings alongside user names.

Properties

Name Meaning
Sorted Set The name of the sorted set in Redis to operate on.
Start The start index (inclusive) for the range query in the sorted set (default 0).
Stop The stop index (inclusive) for the range query in the sorted set (-1 means the end).
With Scores Boolean flag indicating whether to include the scores of the members in the returned result.

Output

The output JSON structure for the "Sorted Set Range" operation contains:

  • sortedSet: The name of the sorted set queried.
  • result: An array representing the members retrieved from the sorted set.
    • If With Scores is false, this is an array of member values (strings).
    • If With Scores is true, this is an array of objects each containing the member and its score.

Example output when With Scores is false:

{
  "sortedSet": "leaderboard",
  "result": ["user1", "user2", "user3"]
}

Example output when With Scores is true:

{
  "sortedSet": "leaderboard",
  "result": [
    {"value": "user1", "score": 100},
    {"value": "user2", "score": 90},
    {"value": "user3", "score": 80}
  ]
}

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 or authentication token for connecting to the Redis instance.
  • The node uses a Redis client library internally to perform commands.
  • No additional external services are required beyond the Redis instance.

Troubleshooting

  • Connection errors: Ensure the Redis credentials are correct and the Redis server is reachable.
  • Invalid parameters: For the sorted set operations, ensure that the Start and Stop indices are valid integers and that the sorted set name exists.
  • Score-member pairs error (for zadd): When adding members, the number of arguments must be even (pairs of score and member). If not, the node throws an error.
  • Empty results: If the specified range returns no members, the result array will be empty.
  • Timeouts or network issues: May cause command failures; verify network stability and Redis server health.
  • Continue on Fail: If enabled, errors for individual items will be included in the output JSON under an error property instead of stopping execution.

Links and References

Discussion