DECRBY(3valkey)
π 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 π
append(3valkey)decr(3valkey)delifeq(3valkey)get(3valkey)getdel(3valkey)getex(3valkey)getrange(3valkey)getset(3valkey)incr(3valkey)incrby(3valkey)incrbyfloat(3valkey)lcs(3valkey)mget(3valkey)mset(3valkey)msetnx(3valkey)psetex(3valkey)set(3valkey)setex(3valkey)setnx(3valkey)setrange(3valkey)strlen(3valkey)substr(3valkey)
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
- 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