โ Redis learning pathRedis ยท Module 2 of 10
Strings and keys
Strings are the simplest Redis type; keys can expire on their own.
๐ Key ideas
- SET name value stores a string; GET name reads it.
- INCR and DECR change numbers atomically, great for counters.
- EXPIRE key seconds (or SET ... EX) makes a key delete itself later.
- TTL key shows how many seconds are left.
- Use clear key names like user:42:name.
๐ก Real-life example: Like a sticky note with a self-destruct timer: it tells you the value, then disappears when its time is up.
SETStore a value under a key
GETRead the value of a key
INCRAdd one to a number atomically
TTLSeconds left before a key expires