DISCARD
DISCARD
- Group
- Transactions
- Complexity
- O(N) where N is the number of queued commands
- Arity
- 1 (exactly, counting the command name)
- Flags
- fast
- HotKV Cloud
- All plans
- On-Premise
- no license needed
DISCARD throws away every command queued since MULTI,
ends the transaction without running anything, and unwatches all keys watched
with WATCH.
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| The transaction was discarded | Simple string OK |
Simple string OK |
No MULTI was sent |
Error ERR DISCARD without MULTI |
Error |
Examples
Section titled “Examples”127.0.0.1:6379> MULTIOK127.0.0.1:6379(TX)> DEL importantQUEUED127.0.0.1:6379(TX)> DISCARDOK127.0.0.1:6379> EXISTS important(integer) 1Compatibility
Section titled “Compatibility”Same as Redis 7 and Valkey 8.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.