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

This node is beneficial in scenarios where you need to:

  • Store and retrieve cached data.
  • Manage real-time messaging or queues using Redis lists.
  • Perform atomic increments or conditional key updates.
  • Work with complex data structures like hashes, sets, and sorted sets.
  • Execute Lua scripts for custom Redis logic.

For example, you can use this node to:

  • Retrieve all values from a hash (operation: "Hash Values").
  • Increment a counter atomically.
  • Push messages to a Redis list for queue processing.
  • Check if certain keys exist before proceeding.
  • Publish messages to Redis channels for event-driven workflows.

Properties

Name Meaning
Operation The Redis command to execute. Options include Append, Blocking Pop Left/Right, Delete, Exists, Expire, Get, Hash Exists, Hash Keys, Hash Length, Hash Values, Increment, Info, Keys, List Length, Multi Get, Multi Set, Persist, Pop, Publish, Push, Scan, Set, Set Add, Set Cardinality, Set Is Member, Set Members, Set Remove, Sorted Set Add, Sorted Set Cardinality, Sorted Set Range, Sorted Set Remove, String Length, TTL, etc.
Value Is JSON (Only for hash key type) Whether the value is JSON or key-value pairs.
Hash (For hash-related operations) Name of the hash key in Redis.

Additional properties depend on the selected operation, for example:

  • Key: Name of the Redis key to operate on.
  • Property Name: The property path in the output JSON where results are stored.
  • Key Type: Data type of the key (Automatic, Hash, List, Sets, String).
  • Value: Value to set or append.
  • Expire: Whether to set an expiration timeout on the key.
  • TTL: Time-to-live in seconds for expiration.
  • Channel: Channel name for publish operation.
  • List: List name for push/pop operations.
  • Members: Members for set or sorted set operations.
  • Score-Member Pairs: For sorted set additions.
  • Field: Field name for hash existence check.
  • Script: Lua script to execute.
  • Keys and Arguments: Parameters for Lua script execution.
  • Timeout: Timeout in seconds for blocking pop operations.
  • Cursor, Pattern, Count: For scan operation parameters.

Output

The node outputs an array of items, each containing a json object with the result of the executed Redis operation. The structure varies depending on the operation:

  • For retrieval operations (e.g., get, hvals, hkeys), the output contains the requested data mapped to specified property names.
  • For existence checks, it returns booleans indicating presence.
  • For list/set operations, it returns counts or arrays of members.
  • For increment or append operations, it returns the new numeric value or string length.
  • For Lua script execution, it returns the script result.
  • For operations that modify data (set, delete, push, pop), it returns confirmation or the affected data.
  • If dot notation is enabled, nested properties can be created in the output JSON.

The node does not output binary data.

Dependencies

  • Requires a Redis server accessible via credentials configured in n8n.
  • Needs an API key or authentication token for Redis connection (configured as credentials in n8n).
  • Uses the Redis client library internally to communicate with Redis.
  • No additional external services are required beyond Redis itself.

Troubleshooting

  • Connection errors: Ensure Redis credentials are correct and the Redis server is reachable.
  • Invalid key/value formats: When setting or adding data, ensure the input matches expected types (e.g., score-member pairs must be even-numbered).
  • Lua script errors: Syntax or runtime errors in Lua scripts will cause failures; validate scripts independently.
  • Operation not supported: Using an unsupported operation or missing required parameters will throw errors.
  • Key-value pairs mismatch: For multi-set operations, the number of arguments must be even; otherwise, an error is thrown.
  • Timeouts in blocking pop: If timeout is zero, the node waits indefinitely; consider setting a finite timeout to avoid hanging workflows.
  • Use the "Continue On Fail" option to handle errors gracefully in batch executions.

Links and References

Discussion