redishiredis

How do redis increment commands react to overflow?


In redis integer increment commands, more specifically:

INCR / INCRBY
HINCRBY

what is the behavior when incrementing 1-past the maximum value (ie 64bit signed range)?


Solution

  • It would error saying that the increment would overflow:

    127.0.0.1:6379> set foo 9223372036854775807
    OK
    127.0.0.1:6379> incr foo
    (error) ERR increment or decrement would overflow