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 including setting, getting, deleting keys, manipulating lists, sets, sorted sets, hashes, and executing Lua scripts. The node is useful for scenarios where you need to store, retrieve, or manipulate data in Redis within an n8n workflow, such as caching, session management, real-time messaging, or atomic locking.

The Set operation specifically allows you to write data into Redis keys with flexible control over the key type (string, hash, list, set), conditional setting modes (always set, set if not exists, set if exists), and optional expiration timeouts. This makes it practical for use cases like updating cache entries, managing counters, or storing structured data atomically.

Properties

Name Meaning
Key The name of the Redis key to set.
Value The value to write into the Redis key.
Key Type The data type of the key. Options:
- Automatic: Detects type based on data.
- Hash: Data stored as a hash.
- List: Data stored as a list.
- Sets: Data stored as a set.
- String: Data stored as a string.
Value Is JSON (Only for Hash key type) Whether the value is JSON or key-value pairs. Defaults to true.
Expire Whether to set a timeout (expiration) on the key. Boolean flag.
TTL Number of seconds before the key expires if Expire is enabled. Minimum value is 1 second.
Set Mode Controls when the key should be set (only applies to String or Automatic key types). Options:
- Always Set: Set regardless of existence.
- Set If Not Exists (NX): Set only if key does not exist.
- Set If Exists (XX): Set only if key exists.

Output

The output is an array of JSON objects representing the result of the set operation for each input item. Each output JSON includes:

  • The original input JSON merged with a new property redis_result that contains the result returned by the Redis client after setting the key.

Example output JSON structure:

{
  "originalInputProperties": { ... },
  "redis_result": "<result from Redis set operation>"
}

No binary data output is produced by this operation.

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 connect and execute commands.
  • No additional external services are required beyond the Redis instance.

Troubleshooting

  • Common issues:

    • Connection failures due to incorrect Redis credentials or network issues.
    • Invalid key or value formats, especially when using JSON for hash values.
    • Setting TTL without enabling expiration will have no effect.
    • Using incompatible Set Mode with certain key types may cause unexpected behavior.
  • Error messages:

    • Errors from Redis commands (e.g., invalid arguments) will be thrown as node errors unless "Continue On Fail" is enabled.
    • If key-value pairs for multi-set operations are uneven, an error is raised.
    • Parsing errors when expecting JSON but receiving invalid JSON strings.
  • Resolutions:

    • Verify Redis credentials and connectivity.
    • Ensure correct data types and formats for keys and values.
    • Enable expiration explicitly if TTL is set.
    • Use appropriate Set Mode according to your logic needs.

Links and References

Discussion