Actions37
- Append
- Blocking Pop Left
- Blocking Pop Right
- Delete
- Eval
- Exists
- Expire At
- Get
- Get Set
- Hash Exists
- Hash Keys
- Hash Length
- Hash Values
- Increment
- Info
- JSON Get
- JSON Set
- Keys
- List Length
- Multi Get
- Multi Set
- Persist
- Pop
- Publish
- Push
- Scan
- Set
- Set Add
- Set Cardinality
- Set Is Member
- Set Remove
- Sorted Set Add
- Sorted Set Cardinality
- Sorted Set Range
- Sorted Set Remove
- String Length
- TTL
Increment
AI-generatedSummary
Atomically increments the value of the given Redis key by 1, creating the key if it does not exist. Optionally sets an expiration time (TTL) on the key after incrementing.
Inputs
- Key (required) — The name of the Redis key to increment.
- Expire — Boolean flag to determine whether to set an expiration timeout on the key after incrementing.
- TTL — If Expire is true, the number of seconds before the key expires.
Output shape
a single JSON object containing the incremented value under the key name provided as input
The output JSON object has one property with the key name and the incremented numeric value. If Expire is enabled and TTL specified, the key is set to expire after the TTL. Errors may be returned depending on connection or command failure.
Examples
Example 1: Increment a Redis key "counter" without expiration
Set Key to "counter", Expire to false (default). Expect incremented count value in output.
Example 2: Increment a Redis key "sessionCount" with an expiration of 300 seconds
Set Key to "sessionCount", Expire to true, TTL to 300. After incrementing, the key will expire in 300 seconds.