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 "Redis Enhanced" node provides a comprehensive interface to interact with a Redis database, supporting a wide range of operations such as getting, setting, deleting keys, working with hashes, lists, sets, sorted sets, and executing Lua scripts. The "Hash Length" operation specifically retrieves the number of fields in a given hash stored in Redis.
This node is beneficial in scenarios where you need to manage and manipulate Redis data structures directly within an n8n workflow. For example, you might use it to monitor the size of a hash representing user sessions or configuration settings, enabling conditional logic based on the number of entries.
Practical example: You have a Redis hash storing user profile attributes, and you want to trigger an alert if the number of attributes exceeds a certain threshold. Using the "Hash Length" operation, you can retrieve the count of fields in that hash and proceed accordingly.
Properties
| Name | Meaning |
|---|---|
| Value Is JSON | Whether the value is JSON or key-value pairs (boolean). Relevant when working with hashes. |
| Hash | Name of the hash in Redis whose length (number of fields) you want to retrieve (string). |
Output
The output JSON object for the "Hash Length" operation contains:
hash: The name of the hash queried.length: The number of fields present in the specified hash.
Example output JSON:
{
"hash": "myHash",
"length": 5
}
This indicates that the hash named "myHash" contains 5 fields.
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
Common issues:
- Connection failures due to incorrect Redis credentials or network issues.
- Specifying a non-existent hash name will return a length of zero without error.
- Providing invalid input types or empty hash names may cause errors.
Error messages:
- Errors related to connection or command execution will be thrown by the node.
- If the node is set to continue on failure, errors will appear in the output JSON under an
errorproperty.
Resolutions:
- Verify Redis credentials and network connectivity.
- Ensure the hash name is correctly specified and exists in Redis.
- Use the "continue on fail" option to handle errors gracefully in workflows.