DECRBY(3valkey)

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

πŸ’– DECRBY πŸ’–

okay so bestie, we're in the valkey command manual (section 3, the library-functions girlies), and today's main character is DECRBY. she takes a number and she takes it down. that's it. that's the vibe. ✨


🌸 NAME 🌸

decrby β€” decrements a number from the integer value of a key. and if the key doesn't exist yet? no worries, she uses 0 as the initial value. starting from zero, living her truth. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

DECRBY key decrement

✨ DESCRIPTION ✨

so what she does is: she takes the number stored at key and she decrements it by decrement. simple. iconic. no cap.

if the key does not exist, she sets it to 0 first and then does the operation. like, she's not gonna show up to a party with no outfit, she builds the fit from scratch. 🫢

but bestie, listen β€” an error gets returned if the key holds a value of the wrong type, or if it holds a string that can not be represented as integer. she's not a miracle worker, she's a number girlie. 😭

also, this operation is limited to 64 bit signed integers. know your limits, love yourself. πŸ’€

and hey β€” go peek at INCR if you want the extra tea on increment/decrement operations in general. iykyk. πŸ‘‘


πŸ’¬ REPLY πŸ’¬

valkey-protocol(7) Integer reply: the value of the key after decrementing it. so she tells you where she landed. she's transparent like that. ✨


πŸ¦‹ COMPLEXITY πŸ¦‹

O(1) β€” constant time, baby. instant. no waiting, no loading screen, she ate and left no crumbs. πŸ”₯


πŸ‘‘ ACL CATEGORIES πŸ‘‘

  • @fast
  • @string
  • @write

🌈 HISTORY 🌈

  • Available since: 1.0.0 β€” an OG, a legend, been here since day one. ⭐

πŸ“ EXAMPLES πŸ“

127.0.0.1:6379> SET mykey "10"
OK
127.0.0.1:6379> DECRBY mykey 3
(integer) 7

like. 10 minus 3 is 7. she did the math, she showed the receipts, she slayed. πŸ’–


πŸ’œ SEE ALSO πŸ’œ

the whole friend group fr fr, go say hi. 🧚


okay that's the whole page bestie!! this was version 9.0.0, dated 2025-10-21, and it lives under DECRBY(3valkey). go forth and decrement responsibly. mwah. πŸ’‹ periodt. βœ¨πŸŽ€πŸ¦‹πŸ’…

πŸ“¦ where this page comes from