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 perform advanced Redis commands within n8n workflows without writing custom code.

For the Sorted Set Cardinality operation specifically, the node retrieves the number of members in a specified sorted set. This is useful when you need to know the size of a sorted set, for example, to monitor leaderboard sizes, count unique scored items, or manage ranked data collections.

Practical examples:

  • Counting how many players are currently on a game leaderboard stored as a sorted set.
  • Determining the number of scored events recorded in a time-series sorted set.
  • Monitoring the cardinality of a sorted set used for priority queues or ranking systems.

Properties

Name Meaning
Sorted Set The name of the sorted set in Redis whose cardinality (number of members) you want to get.

Note: The provided properties JSON includes "Value Is JSON" but it applies only when the key type is "hash" and is not relevant for the "Sorted Set Cardinality" operation.

Output

The output JSON object contains:

  • sortedSet: The name of the sorted set queried.
  • cardinality: The number of members in the sorted set (an integer).

Example output JSON:

{
  "sortedSet": "mySortedSet",
  "cardinality": 42
}

This output allows downstream nodes to use the cardinality value for conditional logic, reporting, or further processing.

Dependencies

  • Requires a connection to a Redis instance.
  • Needs an API key credential or equivalent Redis authentication configured in n8n credentials.
  • The node uses the Redis client library internally to communicate with Redis.

Troubleshooting

  • Common issues:

    • Connection failures due to incorrect Redis credentials or network issues.
    • Specifying a non-existent sorted set will return a cardinality of zero without error.
    • Providing an empty or invalid sorted set name will cause an error.
  • Error messages:

    • Errors related to Redis connection or command execution will be thrown as node operation errors.
    • If the node is set to continue on fail, errors will be returned in the output JSON under an error property.
  • Resolutions:

    • Verify Redis credentials and network connectivity.
    • Ensure the sorted set name is correct and exists in Redis.
    • Use the "continue on fail" option to handle errors gracefully in workflows.

Links and References

Discussion