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 including data retrieval, modification, and management. Specifically, the Increment operation atomically increments the value of a specified key by 1, creating the key if it does not exist. Optionally, it can set an expiration timeout on the key.

This node is beneficial in scenarios where you need to maintain counters or sequence numbers in Redis, such as tracking page views, API usage counts, or generating unique IDs. For example, incrementing a "user_login_count" key each time a user logs in, optionally expiring the count after a certain period.

Properties

Name Meaning
Key The name of the Redis key to increment.
Expire Boolean flag indicating whether to set a timeout (expiration) on the key after incrementing.
TTL Number of seconds before the key expires if Expire is true. Minimum value is 1 second.

Output

The output JSON contains the incremented value of the specified key. The key name is used as the property name, and its value is the new integer value after increment.

Example output JSON for key "counter" incremented to 5:

{
  "counter": 5
}

No binary data output is produced by this operation.

Dependencies

  • Requires a connection to a Redis instance.
  • Needs an API authentication credential configured in n8n to connect securely to Redis.
  • Uses Redis commands INCR and optionally EXPIRE.

Troubleshooting

  • Common issues:

    • Connection failures due to incorrect Redis credentials or network issues.
    • Attempting to increment a key that holds a non-integer value will cause Redis errors.
    • Setting expiration (Expire = true) with invalid TTL values (less than 1) may cause unexpected behavior.
  • Error messages:

    • Errors related to Redis connection or command execution will be thrown as node operation errors.
    • If the node is configured to continue on failure, errors will be returned in the output JSON under an error property.
  • Resolutions:

    • Verify Redis credentials and network connectivity.
    • Ensure the key being incremented either does not exist or holds an integer value.
    • Use valid TTL values when enabling expiration.

Links and References

Discussion