1. Store a value
SET writes a string value to a key, creating or overwriting it.
SET user:1 "Ada"Typorithm · easy
Step 1 of 8 · intro card
Strings & Keys
SET stores a string value at a key and GET reads it back; the EX option attaches a seconds-based expiry, TTL reports the remaining life, and DEL removes a key entirely.
Redis keys are flat strings and values default to strings, so SET user:1 "Ada" simply stores the text Ada under the key user:1, and GET user:1 reads it straight back.
Adding EX 3600 to a SET gives the key a time-to-live of 3600 seconds; once that window elapses Redis evicts the key automatically. TTL session:42 reports how many seconds remain.
DEL user:1 removes a key and its value on the spot. TTL also doubles as a probe: it returns -1 for a key with no expiry and -2 for a key that no longer exists.
SET writes a string value; GET reads it.
EX <seconds> on SET sets a time-to-live.
TTL reports remaining life; DEL removes a key.
SET user:1 "Ada"
GET user:1
SET session:42 "tok" EX 3600
TTL session:42
DEL user:1Connect each part of the code to the concept before you type.
SET writes a string value to a key, creating or overwriting it.
SET user:1 "Ada"GET returns the string value stored at a key, or nil if it does not exist.
GET user:1The EX option gives the key a time-to-live in seconds — here 3600 (one hour).
SET session:42 "tok" EX 3600TTL returns the seconds left before a key expires (-1 if it has no expiry, -2 if it is gone).
TTL session:42DEL deletes a key and its value immediately.
DEL user:1Read the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.