Common check-and-set transaction workflow.

Section: Transactions and optimistic locking

Optimistic transfer transaction

bash
bash
WATCH account:1
GET account:1
MULTI
DECRBY account:1 50
INCRBY account:2 50
EXEC
Explanation

In practice, the client should validate account state after GET and before MULTI/EXEC.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Transactions and optimistic locking
Start a transaction
Queue subsequent commands for EXEC.
OpenIn sheetbashsame section
Execute queued transaction
Run all queued commands atomically.
OpenIn sheetbashsame section
Abandon queued transaction
Clear queued transaction commands.
OpenIn sheetbashsame section
Watch keys for changes
Abort EXEC if watched keys change before commit.
OpenIn sheetbashsame section
Stop watching keys
Clear optimistic-lock watches.
OpenIn sheetbashsame section
Publish a message
Send a message to all subscribers of a channel.
OpenIn sheetbash1 tag match