Redis Enhanced icon

Redis Enhanced

Get, send and update data in Redis with enhanced operations

Overview

This node, "Redis Enhanced," provides a comprehensive interface to interact with a Redis database. It supports a wide range of Redis operations such as getting and setting keys, manipulating hashes, lists, sets, sorted sets, and executing Lua scripts. The node is useful for scenarios where you need to integrate Redis data storage or caching into your workflows, perform atomic increments, publish/subscribe messaging, or manage key expirations.

For example, you can use this node to:

  • Retrieve the number of fields in a Redis hash (Hash Length operation).
  • Check if a specific field exists within a hash.
  • Get all keys matching a pattern.
  • Increment counters atomically.
  • Push or pop elements from Redis lists.
  • Execute custom Lua scripts on the Redis server.

The "Hash Length" operation specifically returns the count of fields in a given Redis hash, which is helpful when you want to know how many entries a hash contains without retrieving all its data.

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 Redis hash to operate on (string). Required for hash-related operations like Hash Length.

Note: These properties are shown when the Resource is "Default" and Operation is "hlen" (Hash Length).

Output

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

{
  "hash": "name_of_the_hash",
  "length": 123
}
  • hash: The name of the Redis hash queried.
  • length: The number of fields contained in that hash.

No binary data output is produced by this operation.

Dependencies

  • Requires a Redis server accessible via credentials configured in n8n.
  • Needs an API key or authentication token for connecting to Redis (configured as credentials in n8n).
  • Uses the Redis client library internally to communicate with the Redis instance.

Troubleshooting

  • Connection errors: If the node cannot connect to Redis, verify the credentials and network connectivity.
  • Invalid hash name: Ensure the hash name provided exists in Redis; otherwise, the length will be zero or an error may occur.
  • Permission issues: Make sure the Redis user has permission to execute the requested commands.
  • Error messages: Errors thrown by Redis (e.g., wrong data type for a key) will be surfaced. Use the "Continue On Fail" option to handle errors gracefully in workflows.

Links and References

Discussion