The Desi Architect
Notes / Docker Sandboxes / Redis Basics: Every Command You Need Before Any Redis Lab
Docker Sandboxes · Tier 0: Start Here · Lab 06

Redis Basics: Every Command You Need Before Any Redis Lab

A guided tour of Redis before you meet it in a cache, a rate limiter, a queue or a lock. Strings, counters, expiry, lists, hashes, sets and sorted sets, with every command run for real and every reply explained.

Time40 minutes
StackRedis 7Ports 16409
MemoryAbout 15 MB
Before thisLab 01Docker Compose Basics
Verified runWindows, Mac, LinuxBash and PowerShell
  1. 1PrepareWhat you will learn
  2. 2PredictGuess before you run
  3. 3RunStep by step
  4. 4ObserveWhat you should see
  5. 5Break itChange one thing
  6. 6Clean upLeave nothing running
On this page
  1. 00 / What You Will Learn
  2. 01 / Why It Matters
  3. 02 / What We Are Building
  4. 03 / Words You Need
  5. 04 / Predict First
  6. 05 / Step by Step
  7. 06 / What You Should See
  8. 07 / Look Inside
  9. 08 / Break It, Fix It
  10. 09 / In Real Projects
  11. 10 / Interview Corner
  12. 11 / Clean Up

00 /What You Will Learn

By the end you will be able to
  • Say what Redis is, and what it is good and bad at.
  • Store, read, count and delete values with SET, GET, INCR and DEL.
  • Make values expire by themselves with EX and TTL, and read TTL -1 and -2.
  • Pick the right type for the job: string, list, hash, set or sorted set.
  • Explain why KEYS * is dangerous in production and what to use instead.
  • Explain what "atomic" means, and why one command is safe but two are not.

Before you start

You need Docker Desktop running and the basics from Lab 01 (Docker Compose Basics). No Redis knowledge is needed. The lab starts a Redis server with no password, for practice only.

In plain words

Redis is a very fast store that keeps its data in memory (RAM) instead of on disk. Like the whiteboard behind the shopkeeper: today's rates, who is waiting, a running count. Reading and writing takes a fraction of a millisecond.