Actions41
- Append
- Blocking Pop Left
- Blocking Pop Right
- Delete
- Eval
- Exists
- Expire At
- Get
- Get Set
- Hash Exists
- Hash Get
- Hash Keys
- Hash Length
- Hash Set
- Hash Values
- Increment
- Info
- Keys
- List Length
- List Range
- Multi Get
- Multi Hash Get
- Multi Mix Get
- Multi Mix Set
- 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 "Redis Enhanced" node provides a comprehensive interface to interact with a Redis database, supporting a wide range of operations such as managing strings, hashes, lists, sets, sorted sets, and executing Lua scripts. It is designed for scenarios where users need to get, set, update, or delete data in Redis with enhanced capabilities beyond basic commands.
This node is beneficial when integrating Redis into workflows for caching, real-time data processing, messaging (via publish/subscribe), atomic counters, and complex data structure manipulations. For example, it can be used to increment counters atomically, manage user sessions stored as hashes, push/pop items from queues implemented as lists, or check membership in sets.
Specifically, the "Set Cardinality" operation returns the number of members in a given Redis set, which is useful for quickly determining the size of a collection without retrieving all its elements.
Properties
| Name | Meaning |
|---|---|
| Set | The name of the Redis set whose cardinality (number of members) you want to retrieve. |
Note: The provided properties JSON shows only two properties relevant to some set operations, but for "Set Cardinality" specifically, only the Set property is required.
Output
The output JSON object for the "Set Cardinality" operation contains:
set: The name of the Redis set queried.cardinality: The number of members in the specified set.
Example output:
{
"set": "mySet",
"cardinality": 42
}
This output allows downstream nodes or workflows to know how many unique members are in the set without fetching the entire set content.
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 commands.
- No additional external services are required beyond the Redis instance.
Troubleshooting
Common issues:
- Connection failures due to incorrect Redis credentials or network issues.
- Errors if the specified set does not exist or the key is not of type set.
- Invalid input if the set name is empty or malformed.
Error messages:
"Key is not a set": This occurs if the key exists but is not a Redis set. Ensure the key corresponds to a set data type."Connection refused"or"Authentication failed": Check Redis connection settings and credentials."Missing required parameter 'set'": Make sure the set name is provided.
Resolutions:
- Verify Redis credentials and connectivity.
- Confirm the key type in Redis matches the expected set type.
- Provide valid and non-empty set names.