Loading Depth Study
Preparing your workspace
Redis stores data under keys and provides commands for setting, reading, updating, expiring, and deleting values.
The simplest Redis data type is the string. Commands such as SET and GET store and retrieve values. DEL removes a key, EXISTS checks whether a key exists, and EXPIRE sets a lifetime. Redis keys should use clear naming conventions so related data is easy to identify. Expiration is especially useful for temporary caches, tokens, and rate-limiting data.
A course catalog can cache a generated course count under a key such as course:count with a short expiration.
SET course:count 120 GET course:count EXPIRE course:count 60 TTL course:count DEL course:count
The commands store a value, read it, set an expiration, check remaining lifetime, and delete the key.