Database Tutorial #14: Redis Caching Patterns

A database query takes 50ms. The same query through Redis takes 0.1ms. Caching removes load from your database and makes your application faster. Why Cache? Reduce database load — fewer queries hit the database Lower latency — in-memory reads are 100-500x faster than disk reads Absorb traffic spikes — cache handles burst traffic without scaling the database Caching adds complexity. Only cache what you need to. Cache-Aside (Lazy Loading) The most common pattern. Read from cache first; fall back to database on miss. ...

August 7, 2026 · 5 min

Database Tutorial #13: Redis Setup and Data Types

Redis is an in-memory database. It is fast — reads and writes take microseconds. It is used for caching, sessions, rate limiting, pub/sub, queues, and leaderboards. Redis 8.0 (released May 2025) includes JSON, vector search, probabilistic data structures, and time series natively — no extensions needed. Setup with Docker docker run -d \ --name redis \ -p 6379:6379 \ redis:8 \ redis-server --save 60 1 --loglevel warning Connect with redis-cli: redis-cli # or with Docker: docker exec -it redis redis-cli Strings The most basic type. Strings can hold text, numbers, or binary data (up to 512 MB). ...

August 7, 2026 · 4 min