HINCRBY(3valkey)
π HINCRBY π
okay bestie, welcome to the hincrby page of the valkey manual (3valkey, for the record). this one is short, sweet, and lowkey iconic, so let's get into it π«Ά
β¨ NAME β¨
hincrby β increments the integer value of a field in a hash by a number. Uses 0 as initial value if the field doesn't exist.
πΈ SYNOPSIS πΈ
HINCRBY key field increment
π DESCRIPTION π
So here's the tea: it increments the number stored at field in the hash stored at key by increment. that's it, that's the whole vibe.
- if
keydoes not exist, a brand new key holding a hash gets created. main character move fr fr. - if
fielddoes not exist, the value is set to0before the operation is performed. starting from zero, we love a clean slate π
The range of values supported by HINCRBY is limited to 64 bit signed integers. so like, know your limits bestie.
π¦ REPLY π¦
valkey-protocol(7) Integer reply: the value of the field after the increment operation. so it hands you back the glow-up, not the before pic π
β COMPLEXITY β
O(1) β instant. no cap, it's giving speed.
π ACL CATEGORIES π
@fast @hash @write
π HISTORY π
- Available since:
2.0.0β an elder, a legend, a pioneer.
π₯ EXAMPLES π₯
Since the increment argument is signed, both increment and decrement operations can be performed. so you can gas it up or do a little subtraction, your call π
127.0.0.1:6379> HSET myhash field 5
(integer) 1
127.0.0.1:6379> HINCRBY myhash field 1
(integer) 6
127.0.0.1:6379> HINCRBY myhash field -1
(integer) 5
127.0.0.1:6379> HINCRBY myhash field -10
(integer) -5
not the -10 just taking it all the way down to -5 π numbers really said no thoughts head empty.
π§ SEE ALSO π§
hdel(3valkey)hexists(3valkey)hexpire(3valkey)hexpireat(3valkey)hexpiretime(3valkey)hget(3valkey)hgetall(3valkey)hgetex(3valkey)hincrbyfloat(3valkey)hkeys(3valkey)hlen(3valkey)hmget(3valkey)hmset(3valkey)hpersist(3valkey)hpexpire(3valkey)hpexpireat(3valkey)hpexpiretime(3valkey)hpttl(3valkey)hrandfield(3valkey)hscan(3valkey)hset(3valkey)hsetex(3valkey)hsetnx(3valkey)hstrlen(3valkey)httl(3valkey)hvals(3valkey)
and that's the whole page bestie, you ate that π
this lil masterpiece is from valkey version 9.0.0, dated 2025-10-21, and it was a whole HINCRBY(3valkey) moment π stay incrementing, queen πβ¨
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms