redis.set("key", 6)

assert redis.incrby("key", 4) == 10

If a key does not exist, it is initialized as 0 before performing the operation. An error is returned if the key contains a value of the wrong type or contains a string that can not be represented as integer.

Arguments

key
str
required

The key to decrement.

increment
int
required

The amount to increment by.

Response

The value at the key after the incrementing.

redis.set("key", 6)

assert redis.incrby("key", 4) == 10

Was this page helpful?