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 operations such as getting, setting, appending, and deleting keys, working with lists, sets, sorted sets, hashes, and executing Lua scripts. It is designed for users who want enhanced control over Redis data manipulation within n8n workflows.

The Get Set operation specifically allows you to set the value of a key in Redis and simultaneously retrieve its old value. This can be useful in scenarios where you need to update a key but also want to keep track of what the previous value was, for example:

  • Updating a cache entry while logging or processing the previous cached data.
  • Implementing atomic swap operations where the old value is needed immediately after setting a new one.

Properties

Name Meaning
Key The name of the Redis key to set and get the old value from.
Value The new value to set for the specified key.
Name The property name in the output JSON where the old value (the value before setting) will be stored. Supports dot-notation for nested properties.

Output

The output JSON contains the old value of the specified Redis key before it was updated with the new value. The old value is stored under the property name defined by the user (default is "propertyName"). For example, if the property name is "previousValue", the output JSON will look like:

{
  "previousValue": "<old_value>"
}

If the key did not exist before, the old value will typically be null.

No binary data output is involved in this operation.

Dependencies

  • Requires a connection to a Redis instance.
  • Needs an API key credential or equivalent authentication configured in n8n to connect securely to Redis.
  • Uses the Redis client library internally to perform commands.
  • No additional external services are required beyond Redis itself.

Troubleshooting

  • Common issues:

    • Connection failures due to incorrect Redis credentials or network issues.
    • Setting values on keys that do not exist may return null as the old value, which is expected behavior.
    • If the Redis server is unavailable or times out, the node will throw an error.
  • Error messages:

    • Errors related to invalid keys or permissions will be reported by Redis and surfaced by the node.
    • If the node encounters an error during execution and "Continue On Fail" is disabled, it will stop execution and report the error.
    • If "Continue On Fail" is enabled, errors for individual items will be included in the output JSON under an error property.
  • Resolution tips:

    • Verify Redis credentials and connectivity.
    • Ensure the key names and values conform to Redis requirements.
    • Use "Continue On Fail" cautiously to handle partial failures gracefully.

Links and References

Discussion