Redis Hincrby command
Redis Hincrby command is used to add incremental value to specify field values in the hash table.
Increment can also be negative, which is equivalent to a given field and subtraction.
If the key hash table does not exist, a new hash table is created and executed HINCRBY command.
If the specified field does not exist, before executing the command, the value field is initialized to 0.
A field string value stored execution HINCRBY command will cause an error.
The value of this procedure is limited to 64-bit (bit) signed within the digital representation.
grammar
redis Hincrby basic command syntax is as follows:
redis 127.0.0.1:6379> HINCRBY KEY_NAME FIELD_NAME INCR_BY_NUMBER
Available versions
> = 2.0.0
return value
After executing HINCRBY command value fields in the hash table.
Examples
redis 127.0.0.1:6379> HSET myhash field1 20 (integer) 1 redis 127.0.0.1:6379> HINCRBY myhash field 1 (integer) 21 redis 127.0.0.1:6379> HINCRBY myhash field -1 (integer) 20