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 of keys. The "Increment" operation specifically atomically increments the value of a given 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, user actions, or generating unique IDs. For example, incrementing a "page_views" key each time a page is loaded, or counting the number of times a specific event occurs.

Properties

Name Meaning
Key Name of the key in Redis to increment.
Expire Boolean flag indicating whether to set a timeout (expiration) on the key after increment.
TTL Number of seconds before the key expires if "Expire" is true.
Value Is JSON (Not applicable for Increment operation; relevant only when key type is hash.)

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 incremented integer.

Example output:

{
  "yourKeyName": 42
}

This means the key "yourKeyName" was incremented and now holds the value 42.

Dependencies

  • Requires a Redis server connection.
  • Requires an API key credential or authentication token configured in n8n to connect to Redis.
  • Uses the Redis client library internally to perform commands.
  • No additional external dependencies beyond Redis and n8n credentials.

Troubleshooting

  • Common issues:

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

    • Errors from Redis client (e.g., connection refused) will be thrown and can be caught if "Continue On Fail" is enabled.
    • If the key's current value is not an integer, Redis will return an error on increment.
  • Resolutions:

    • Verify Redis credentials and connectivity.
    • Ensure the key either does not exist or holds an integer value before incrementing.
    • Use valid TTL values greater than zero when setting expiration.

Links and References

Discussion