0
0
Redisquery~5 mins

SET and GET commands in Redis - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the Redis SET command do?
The SET command stores a value with a specified key in Redis. It saves data so you can get it later.
Click to reveal answer
beginner
How do you retrieve a value stored in Redis?
Use the GET command with the key to get the stored value back.
Click to reveal answer
beginner
What happens if you use GET on a key that does not exist?
Redis returns null (or nil) because there is no value stored for that key.
Click to reveal answer
intermediate
Can the SET command overwrite an existing key's value?
Yes, SET replaces the old value with the new one if the key already exists.
Click to reveal answer
beginner
What is a simple example of using SET and GET in Redis?
Example:<br>SET name "Alice"<br>Then:<br>GET name<br>Returns: Alice
Click to reveal answer
What does the Redis SET command require as input?
AOnly a value
BA key and a value
COnly a key
DA key, value, and expiration time
What will GET mykey return if mykey does not exist?
AAn error message
BAn empty string
CThe string "null"
DA null or nil value
If you run SET user "Bob" and then SET user "Alice", what will GET user return?
A"Alice"
B"Bob"
CAn error
DBoth values
Which command retrieves the value of a key in Redis?
ADEL
BSET
CGET
DEXPIRE
What type of data structure do SET and GET commands work with in Redis?
AStrings
BHashes
CSets
DLists
Explain how the Redis SET and GET commands work together to store and retrieve data.
Think about saving and looking up a label on a box.
You got /4 concepts.
    Describe what happens if you try to get a key that was never set in Redis.
    Imagine looking for a box label that is not there.
    You got /3 concepts.