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 Redis operations. It allows users to get, set, delete, and manipulate data stored in Redis with enhanced capabilities such as automatic type detection, working with hashes, lists, sets, sorted sets, and executing Lua scripts.

For the Keys operation specifically, this node retrieves all keys matching a given pattern from the Redis instance. Optionally, it can also fetch the values associated with those keys. This is useful for scenarios where you want to list or audit keys in your Redis database, filter keys by patterns (e.g., all keys starting with "user:"), and optionally inspect their values.

Practical examples:

  • Retrieve all cache keys related to user sessions (user:*) and optionally get their current cached values.
  • Audit keys matching a pattern before performing bulk deletion or migration.
  • Monitor keys dynamically created by an application to understand usage patterns.

Properties

Name Meaning
Key Pattern The pattern used to match keys in Redis. Supports wildcards like * to select multiple keys.
Get Values Boolean flag indicating whether to retrieve the values of the matched keys along with the keys themselves. If false, only keys are returned.
Value Is JSON (Shown only if key type is hash) Indicates whether the value should be treated as JSON or as key-value pairs when retrieving hash data.

Output

The output is an array of items, each containing a json object with the results:

  • If Get Values is false:

    • json contains a single property keys which is an array of strings representing the matched keys.
  • If Get Values is true:

    • json contains properties named after each matched key.
    • Each property's value is the corresponding value retrieved from Redis.
    • The value type depends on the Redis key type and may be a string, list, set, hash, or other Redis data types.
    • For hash types, if Value Is JSON is enabled, the value is parsed as JSON or key-value pairs accordingly.

No binary data output is indicated for this operation.

Dependencies

  • Requires a Redis server accessible via credentials configured in n8n.
  • Needs an API authentication token or connection details for Redis (host, port, password, etc.).
  • Uses the Redis client library internally to connect and execute commands.
  • No additional external services are required beyond Redis itself.

Troubleshooting

  • Common issues:

    • Connection failures due to incorrect Redis credentials or network issues.
    • Pattern syntax errors leading to no keys being matched.
    • Large result sets causing timeouts or memory issues if many keys match the pattern.
    • JSON parsing errors if values expected to be JSON are malformed.
  • Error messages:

    • "Key-value pairs must be even number of arguments": Occurs if key-value input strings are malformed (not relevant for Keys operation but common in set operations).
    • Redis connection errors: Check credentials and network connectivity.
    • JSON parse errors: Ensure that values marked as JSON are valid JSON strings.
  • Resolutions:

    • Verify Redis credentials and network access.
    • Use appropriate key patterns to limit the number of matched keys.
    • Validate JSON formatting in stored values if using JSON options.
    • Enable "Continue On Fail" option in n8n to handle errors gracefully during batch processing.

Links and References

Discussion