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 operations such as getting and setting keys, manipulating hashes, lists, sets, sorted sets, and executing Lua scripts. It is designed for users who want to perform advanced Redis commands within n8n workflows without writing custom code.

For the Hash Length operation specifically, the node retrieves the number of fields contained in a specified Redis hash key. This is useful when you need to know how many entries exist in a hash, for example, to monitor data size or validate that a hash contains expected data.

Practical examples:

  • Counting the number of user attributes stored in a Redis hash representing a user profile.
  • Checking the size of a configuration hash before performing updates.
  • Monitoring hash sizes as part of a cache management workflow.

Properties

Name Meaning
Hash The name of the Redis hash key whose length (number of fields) you want to retrieve.

Note: The property "Value Is JSON" exists but is not relevant for the "hlen" (Hash Length) operation.

Output

The output JSON object for the Hash Length operation has the following structure:

{
  "hash": "<name_of_the_hash>",
  "length": <number_of_fields_in_hash>
}
  • hash: The name of the hash key queried.
  • length: An integer representing the count of fields inside the hash.

No binary data output is involved in this operation.

Dependencies

  • Requires a connection to a Redis instance configured via an API key credential or equivalent authentication method.
  • The node depends on the Redis client library to communicate with the Redis server.
  • Proper Redis credentials must be set up in n8n for the node to connect successfully.

Troubleshooting

  • Common issues:

    • Connection failures due to incorrect Redis credentials or network issues.
    • Querying a non-existent hash key will return a length of zero.
    • Permissions or ACL restrictions on the Redis server might prevent access to certain keys.
  • Error messages:

    • Errors during connection or command execution will throw exceptions with messages indicating the problem (e.g., "Connection refused", "WRONGTYPE Operation against a key holding the wrong kind of value").
    • If the node is set to continue on failure, errors are returned in the output JSON under an error field.
  • Resolutions:

    • Verify Redis credentials and network connectivity.
    • Ensure the key exists and is of type hash.
    • Check Redis server logs and permissions if access is denied.

Links and References

Discussion