Overview
The node provides extended Redis operations, allowing users to interact with a Redis database for various common tasks. 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 track occurrences, such as counting page views, tracking API usage, or managing inventory counts. For example, incrementing a "page_views" key each time a webpage is accessed or incrementing a "user_login_attempts" counter.
Properties
| Name | Meaning |
|---|---|
| Key | The name of the Redis key to increment. |
| Expire | Whether to set a timeout (expiration) on the key after incrementing. |
| TTL | Number of seconds before the key expires if "Expire" is enabled. |
| 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 integer value after incrementing.
Example output JSON:
{
"yourKeyName": 42
}
No binary data output is produced by this operation.
Dependencies
- Requires a Redis server accessible via credentials configured in n8n.
- Needs an API key or authentication token for connecting to the Redis instance.
- Uses the Redis client library internally to perform commands like
INCRandEXPIRE.
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 with invalid TTL values (e.g., less than 1 second) may be rejected.
Error messages:
- Connection errors: Check Redis credentials and network connectivity.
- Redis command errors (e.g., wrong type): Ensure the key is either non-existent or holds an integer.
- Timeout errors: Verify TTL is a positive integer when expiration is enabled.
To handle errors gracefully, enable the "Continue On Fail" option in the node settings.
Links and References
- Redis INCR Command Documentation
- Redis EXPIRE Command Documentation
- n8n Redis Node Documentation (for general Redis integration concepts)