Skip to content

Commit

Permalink
Add support for MULTI command in Redis
Browse files Browse the repository at this point in the history
This commit adds support for the MULTI command in Redis. The MULTI command starts a transaction, allowing further commands to be queued but not executed. The
implementation handles the MULTI command and returns "+OK\r\n". Queueing commands and executing a transaction will be covered in later stages. The commit also
includes updated tests and notes for the changes.
  • Loading branch information
rohitpaulk committed Jun 19, 2024
1 parent 6befcfd commit a4d5c33
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions course-definition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3301,7 +3301,27 @@ stages:
description_md: |
In this stage, you'll add support for the `MULTI` command.
**🚧 We're still working on instructions for this stage**. You can find notes on how the tester works below.
### The MULTI command
The [MULTI](https://redis.io/docs/latest/commands/multi/) command starts a transaction.
After a `MULTI` command is executed, any further commands from the same connection will be "queued" but not executed.
Example usage:
```bash
$ redis-cli
> MULTI
OK
> SET foo 41
QUEUED
> INCR foo
QUEUED
```
The queued commands can be executed using [EXEC](https://redis.io/docs/latest/commands/exec/), which we'll cover in later stages.
In this stage, you'll just add support for handling the `MULTI` command and returning `+OK\r\n`. We'll get to queueing commands in later stages.
### Tests
Expand All @@ -3311,13 +3331,17 @@ stages:
./spawn_redis_server.sh
```
The tester will then connect to your server as a Redis client and run the following commands:
The tester will then connect to your server as a Redis client and run the following command:
```bash
$ redis-cli MULTI
```
The tester will expect `+OK\r\n` as the response.
### Notes
- We'll test queueing commands & executing a transaction in later stages.
marketing_md: |
In this stage, you'll implement the MULTI command.
Expand Down

0 comments on commit a4d5c33

Please sign in to comment.