English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Redis Incrby command adds the specified increment value to the numeric value stored in the key.
If the key does not exist, the key's value will be initialized to 0 first, and then the INCRBY command will be executed.
If the value contains an incorrect type, or the string type value cannot be represented as a number, an error is returned.
The value of this operation is limited to 64 Within the range of signed bit numbers.
The basic syntax of the redis Incrby command is as follows:
redis 127.0.0.1:6379> INCRBY KEY_NAME INCR_AMOUNT
>= 1.0.0
The value of key after adding the specified increment value.
# key exists and is a numeric value redis> SET rank 50 OK redis> INCRBY rank 20 (integer) 70 redis> GET rank "70" # key does not exist redis> EXISTS counter (integer) 0 redis> INCRBY counter 30 (integer) 30 redis> GET counter "30" # key is not a numeric value redis> SET book "long long ago..." OK redis> INCRBY book 200 (error) ERR value is not an integer or out of range