Redis Manipulate Cache icon

Redis Manipulate Cache

Manipula dados existentes no Redis de forma parcial

Overview

This node allows partial manipulation of existing data stored in a Redis cache. It is useful when you want to update or modify specific parts of cached data without replacing the entire value. Common scenarios include updating user profile fields, modifying hash entries, or appending/removing items from JSON arrays stored in Redis.

Practical examples:

  • Updating a user's name inside a JSON object stored under a Redis key.
  • Changing a specific field in a Redis hash.
  • Adding a new item to an array within a JSON object cached in Redis.
  • Removing the last item from an array inside a JSON object in Redis.

Properties

Name Meaning
Key The Redis key containing the data to be manipulated (e.g., user:123:profile).
Preserve TTL Boolean flag indicating whether to keep the original expiration time of the Redis key.

Output

The node outputs an array of JSON objects, each representing the result of the operation on a Redis key. Each output object contains:

  • key: The Redis key that was manipulated.
  • operation: The type of operation performed (e.g., update JSON field, update hash field).
  • success: Boolean indicating if the operation succeeded.
  • result: The updated data after manipulation. This can be a JSON object or a hash map depending on the operation.
  • preservedTtl: The remaining time-to-live (TTL) of the key if preserved; otherwise, null.
  • timestamp: ISO string timestamp of when the operation was performed.

The node does not output binary data.

Dependencies

  • Requires a Redis server connection with appropriate credentials (host, port, username, password, TLS options).
  • The node depends on a Redis client wrapper initialized internally.
  • Requires configuration of Redis credentials in n8n with necessary access rights to read and write keys.

Troubleshooting

  • Key does not exist: If the specified Redis key does not exist, the node throws an error stating the key was not found. Ensure the key exists before running the node.
  • Invalid JSON data: When manipulating JSON fields or arrays, if the stored data is not valid JSON, the node will fail with a JSON parsing error. Verify the data format in Redis.
  • Field path errors: For nested JSON operations, incorrect field paths may cause errors like "Path not found" or "Field is not an array." Double-check the field path syntax using dot notation.
  • Preserve TTL issues: If preserving TTL but the key has no expiration or TTL is negative, the TTL preservation step is skipped silently.
  • Redis connection errors: Misconfigured credentials or network issues will cause connection failures. Confirm Redis server accessibility and credential correctness.

Links and References

Discussion