Redis Enhanced icon

Redis Enhanced

Get, send and update data in Redis with enhanced operations

Overview

The node "Redis Enhanced" provides advanced interaction capabilities with a Redis database. It supports a wide range of Redis operations, including setting, getting, deleting keys, manipulating lists, sets, hashes, sorted sets, and executing Lua scripts. This node is beneficial in scenarios where users need to integrate Redis data storage or caching into their workflows, such as managing session data, implementing distributed locks, caching API responses, or real-time messaging via Redis Pub/Sub.

For the Set operation specifically, the node allows writing data to Redis keys with flexible control over key types (string, hash, list, set) and conditional setting modes (always set, set if not exists, set if exists). It also supports setting expiration times on keys, which is useful for temporary data like tokens or cache entries.

Practical example:

  • Storing user session data as a hash with JSON values.
  • Setting a string key only if it does not already exist to implement an atomic lock.
  • Adding a timeout to a cache key so it expires automatically after a certain period.

Properties

Name Meaning
Key The name of the Redis key to set.
Value The value to write into the Redis key.
Key Type The type of the Redis key to set. 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. If true, the value is parsed as JSON before storing.
Expire Whether to set a timeout (expiration) on the key.
TTL Number of seconds before the key expires (only applicable if Expire is true).
Set Mode Controls when the key should be set (only for String or Automatic key types). Options:
- Always Set: Set the key 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 JSON contains the original input data merged with a redis_result field that holds the result of the set operation. The exact content of redis_result depends on the Redis command's response but typically confirms success or provides additional metadata.

Example output JSON structure:

{
  "...originalInputFields": "...",
  "redis_result": "<result from Redis SET or equivalent command>"
}

No binary data output is produced by this operation.

Dependencies

  • Requires a Redis server connection configured via credentials providing necessary authentication (e.g., host, port, password).
  • Uses a Redis client library to connect and execute commands.
  • No additional environment variables are explicitly required beyond the Redis connection credentials.

Troubleshooting

  • Common issues:

    • Incorrect Redis credentials or unreachable Redis server will cause connection failures.
    • Providing invalid key-value pairs or malformed JSON (when Value Is JSON is true) may cause errors.
    • Using incompatible Key Type and Value formats can lead to unexpected behavior or errors.
    • Setting TTL without enabling Expire will have no effect.
  • Error messages:

    • Connection errors: Check Redis server availability and credential correctness.
    • Parsing errors for JSON values: Ensure the value is valid JSON if Value Is JSON is enabled.
    • Validation errors for key-value pairs: Make sure inputs conform to expected formats.
  • To handle errors gracefully, enable the node’s "Continue On Fail" option to allow workflow continuation despite individual item failures.

Links and References

Discussion