In this stage, you'll add support for the WATCH command.
The WATCH command marks a key to be monitored for changes.
If the watched key is modified by another client before the transaction is executed, the transaction will be aborted. This enables simple optimistic locking behavior in Redis.
Example Usage:
$ redis-cli WATCH key
OK
The response is always the simple string "+OK\r\n".
The tester will execute your program like this:
$ ./your_program.shThe tester will then send a WATCH command with a key.
$ redis-cli WATCH key (expecting "+OK\r\n" as the response)- In this stage, you'll only need to handle replying to the
WATCHcommand outside of a transaction. - We will get to disallowing the
WATCHcommand inside a transaction in the next stage.