DISCARD(3valkey)
π DISCARD β the "nvm bestie, forget it" command
okay so real talk, discard is a valkey command and it does exactly one thing: it throws your whole transaction in the trash and pretends it never happened. no cap.
β¨ SYNOPSIS β¨
DISCARD
that's it. that's the whole vibe. no args, no options, no notes. she's low maintenance. π
π¦ DESCRIPTION π¦
DISCARD flushes all previously queued commands in a transaction and restores the connection state to normal.
so like. you were building a whole thing with MULTI and queueing up commands like a good little main character, and then you changed your mind? iconic. DISCARD empties the queue, nothing runs, and your connection goes back to its regular non-transaction self. we love a clean slate. β¨
If WATCH was used, DISCARD unwatches all keys watched by the connection.
translation: if you were keeping an eye on some keys π, that watch is cancelled too. no lingering parasocial key relationships here. π«Ά
πΈ REPLY πΈ
valkey-protocol(7) Simple string reply: OK.
it says OK and means it. fr fr.
π COMPLEXITY π
O(N), when N is the number of queued commands
so the more nonsense you queued up, the longer it takes to throw away. make it make sense, but that's the math. π
π₯ ACL CATEGORIES π₯
@fast@transaction
π HISTORY π
- Available since:
2.0.0
she's been serving since 2.0.0. a legend. a pioneer. periodt.
π SEE ALSO π
not me reminding you that if you don't DISCARD, those queued commands are still sitting there waiting. vibe check your transactions, bestie. π
valkey command manual, version 9.0.0, dated 2025-10-21 β mwah, go slay your transactions, iykyk π§π
π¦ 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