Hash

HINCRBY

Increments the value of a hash field by a given amount

If the hash field does not exist, it is set to 0 before performing the operation.

Arguments

keybodystrrequired

The key of the hash.

fieldbodystrrequired

The field to increment

incrementbodyint

How much to increment the field by. Can be negative to subtract.

Response

intrequired

The new value of the field after the increment.

Example
redis.hset("myhash", "field1", 5)assert redis.hincrby("myhash", "field1", 10) == 15
Loading search…