Concept Flow - SET and GET commands
Start
SET key value
Store value in key
GET key
Retrieve value
Output value
End
The flow shows storing a value with SET, then retrieving it with GET, and finally outputting the stored value.
SET name "Alice"
GET name| Step | Command | Action | Key | Value Stored | Output |
|---|---|---|---|---|---|
| 1 | SET name "Alice" | Store value | name | "Alice" | OK |
| 2 | GET name | Retrieve value | name | "Alice" | "Alice" |
| 3 | GET age | Retrieve value | age | null | (nil) |
| Variable | Start | After Step 1 | After Step 2 | After Step 3 |
|---|---|---|---|---|
| name | null | "Alice" | "Alice" | "Alice" |
| age | null | null | null | null |
SET key value - stores a value under a key GET key - retrieves the value stored If key does not exist, GET returns (nil) SET returns OK on success GET returns the stored value as a string
SET command do?SET command in Redis is used to save or store a value associated with a key.GET retrieves values, DEL deletes keys, and KEYS lists keys, so they are not correct here.SET key value without commas or quotes unless the shell requires them.SET color blue GET color SET color red GET color
GET commands?SET color blue stores "blue". The first GET color returns "blue".SET color red overwrites the value with "red". The second GET color returns "red".GET username but get a nil response. Which of the following could fix this issue?SET username "guest". Other options do not create the key.SET session:123 abc123token to save the token under the key.GET session:123 to fetch the token value.Pass the test and this pattern moves unknown