HINCRBY

Since 1.1.0Hashes

Syntax

HINCRBY key field increment
  • Flags: fast, write
  • ACL categories: @fast, @hash, @write
  • Arity: 4

Adds increment, a 64-bit integer, to the integer value of field in the hash at key. A missing field counts as 0. The field keeps its expiry, if it has one.

Reply

  • The value after the increment.
  • ERR hash value is not an integer if the field's value is not an integer.

Examples

> HINCRBY u age 36
(integer) 36
> HINCRBY u age 1
(integer) 37
> HSET u name Ada
(integer) 1
> HINCRBY u name 1
(error) ERR hash value is not an integer