Redis Enhanced icon

Redis Enhanced

Get, send and update data in Redis with enhanced operations

Overview

The "Redis Enhanced" node provides a comprehensive interface to interact with a Redis database, supporting a wide range of operations including string manipulation, list handling, set and sorted set management, hash operations, key scanning, and Lua script execution. The "Hash Length" operation specifically retrieves the number of fields contained within a specified Redis hash.

This node is beneficial in scenarios where you need to efficiently manage and query data stored in Redis, such as caching, session storage, real-time analytics, or message brokering. For example, using the "Hash Length" operation, you can quickly determine how many entries exist in a user profile hash or configuration settings hash without retrieving all the data.

Properties

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

Note: The provided properties JSON includes "Value Is JSON" but it is not relevant for the "hlen" (Hash Length) operation and thus omitted here.

Output

The output JSON object contains:

  • hash: The name of the hash queried.
  • length: The number of fields present in the specified hash.

Example output:

{
  "hash": "user:1234",
  "length": 5
}

This indicates that the hash named "user:1234" contains 5 fields.

Dependencies

  • Requires a Redis server accessible via credentials configured in n8n.
  • Needs an API key credential or connection details for Redis authentication.
  • Uses the Redis client library internally to perform commands.
  • No additional external services are required beyond Redis itself.

Troubleshooting

  • Common issues:

    • Connection failures due to incorrect Redis credentials or network issues.
    • Specifying a non-existent hash will return a length of 0 without error.
    • If the Redis server is unavailable or times out, the node will throw an error unless "Continue On Fail" is enabled.
  • Error messages:

    • Errors related to connection or command execution will include the Redis error message.
    • Invalid input parameters (e.g., empty hash name) may cause errors.
  • Resolutions:

    • Verify Redis credentials and network connectivity.
    • Ensure the hash name is correctly specified.
    • Use "Continue On Fail" option to handle errors gracefully in workflows.

Links and References

Discussion