File tree 1 file changed +47
-1
lines changed
1 file changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -3712,7 +3712,53 @@ stages:
3712
3712
name : " Multiple transactions"
3713
3713
difficulty : medium
3714
3714
description_md : |
3715
- **🚧 We're still working on instructions for this stage**. You can find notes on how the tester works below.
3715
+ In this stage, you'll add support for multiple concurrent transactions.
3716
+
3717
+ ### Multiple transactions
3718
+
3719
+ There can be multiple transactions open (i.e. `MULTI` has been called, but `EXEC` has not been called yet) at the same time. Each
3720
+ transaction gets its own command queue.
3721
+
3722
+ For example, say you started transaction 1 from one connection:
3723
+
3724
+ ```bash
3725
+ $ redis-cli
3726
+ > MULTI
3727
+ OK
3728
+ > SET foo 41
3729
+ QUEUED
3730
+ > INCR foo
3731
+ QUEUED
3732
+ ```
3733
+
3734
+ and started transaction 2 from another connection:
3735
+
3736
+ ```bash
3737
+ $ redis-cli
3738
+ > MULTI
3739
+ OK
3740
+ > INCR foo
3741
+ QUEUED
3742
+ ```
3743
+
3744
+ If you then run `EXEC` in transaction 1, you should see the following:
3745
+
3746
+ ```bash
3747
+ > EXEC
3748
+ 1) OK
3749
+ 2) (integer) 42
3750
+ ```
3751
+
3752
+ `OK` is the response to `SET foo 41`, and `42` is the response to `INCR foo`.
3753
+
3754
+ And for transaction 2, running `EXEC` should return:
3755
+
3756
+ ```bash
3757
+ > EXEC
3758
+ 1) (integer) 43
3759
+ ```
3760
+
3761
+ 43 is the response to `INCR foo`. The key `foo` was updated to `42` by transaction 1, and `INCR foo` further increments it to `43`.
3716
3762
3717
3763
### Tests
3718
3764
You can’t perform that action at this time.
0 commit comments