INCR
Since 1.1.0StringsKnown issue
Syntax
INCR keyAdds 1 to the integer stored at key. A missing key counts as 0. The value must be a string that reads as a signed 64-bit integer.
Reply
- The value after the increment.
ERR value is not an integer or out of rangeif the value is not an integer.- A
WRONGTYPEerror if the key is not a string.
Examples
> SET n 10
OK
> INCR n
(integer) 11
> INCR missing
(integer) 1
Known issue
In KiviDB 1.1, INCR on a key holding the largest 64-bit integer, 9223372036854775807, does not return an overflow error: the value wraps around to -9223372036854775808. INCRBY key 1 returns ERR increment or decrement would overflow instead, as Redis does, and so does DECR at the other end. Filed as kividb#124, fixed in 1.2.