Actions36
- Append
- Blocking Pop Left
- Blocking Pop Right
- Delete
- Eval
- Exists
- Expire At
- Get
- Get Set
- Hash Exists
- Hash Keys
- Hash Length
- Hash Values
- Increment
- Info
- Keys
- List Length
- List Range
- Multi Get
- 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. 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 for this node is automating workflows that require caching, real-time data processing, or message publishing using Redis as a backend. For example, it can be used to:
- Retrieve the number of members in a sorted set (Sorted Set Cardinality).
- Add or remove elements from sorted sets or lists.
- Publish messages to Redis channels for event-driven architectures.
- Execute Lua scripts for complex atomic operations.
Specifically, the "Sorted Set Cardinality" operation returns the count of members in a specified sorted set, which is useful for monitoring or controlling the size of ranked data collections such as leaderboards or priority queues.
Properties
| Name | Meaning |
|---|---|
| Sorted Set | The name of the sorted set in Redis on which the operation will be performed. |
| Value Is JSON | (Shown only if key type is "hash") Indicates whether the value is JSON or key-value pairs. |
Note: The provided properties are a subset relevant to the "Sorted Set Cardinality" operation and the "Default" resource context.
Output
The output JSON object for the "Sorted Set Cardinality" operation contains:
sortedSet: The name of the sorted set queried.cardinality: The number of members currently in the sorted set.
Example output JSON:
{
"sortedSet": "mySortedSet",
"cardinality": 42
}
This output allows downstream nodes or workflows to understand the size of the sorted set at runtime.
The node does not output binary data.
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 perform operations.
- No additional external services are required.
Troubleshooting
Common issues:
- Connection failures due to incorrect Redis credentials or network issues.
- Errors when the specified sorted set does not exist or is of a different data type.
- Malformed input parameters, e.g., empty sorted set name.
Error messages and resolutions:
"Key does not exist": Ensure the sorted set name is correct and exists in Redis."WRONGTYPE Operation against a key holding the wrong kind of value": The key exists but is not a sorted set; verify the key type.- Connection timeout or authentication errors: Check Redis credentials and network connectivity.
"Score-member pairs must be even number of arguments"(for zadd operation): Provide valid score-member pairs.
To handle errors gracefully, enable the "Continue On Fail" option in the node settings.