HINCRBY(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

πŸ’– 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 key does not exist, a brand new key holding a hash gets created. main character move fr fr.
  • if field does not exist, the value is set to 0 before 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 🧚


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