Skip to content

Commit

Permalink
update tester information
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitpaulk committed Oct 4, 2023
1 parent ad24b0d commit 139e713
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions course-definition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,23 @@ stages:
difficulty: medium
description_md: |-
In this stage, you'll need to support setting a key with an expiry. The
expiry is provided using the "PX" argument to the
expiry is provided in milliseconds using the "PX" argument to the
[SET](https://redis.io/commands/set) command.
The tester will first send a `SET` command with an expiry, like this: `SET <key> <value> PX <expiry>`.
Then, it will send a `GET` command to retrieve the value, like this: `GET <key>`. If the key has expired, the
tester will expect a Null value as the response. Read about "Null Bulk Strings"
[here](https://redis.io/docs/reference/protocol-spec/#resp-bulk-strings) to know how to send a Null value.
The tester will do the following:
```
# First, it'll set a key with an expiry (100 milliseconds in this example)
$ redis-cli set random_key random_value px 100
# Immediately after, it'll send a GET command to retrieve the value
# The response to this should be "random_value" (encoded as a RESP bulk string)
$ redis-cli get random_key
# Then, it'll wait for the key to expire and send another GET command
# The response to this should be `-1\r\n` (a "null bulk string")
$ sleep 0.2 && redis-cli get random_key
```
{{#lang_is_haskell}}
The [time](https://hackage.haskell.org/package/time) package is available
Expand Down

0 comments on commit 139e713

Please sign in to comment.