About this course
About this course
This free course teaches you Redis from the ground up - no prior experience with Redis needed. You'll start by understanding what an in-memory key-value store is, run Redis with Docker, and learn its core data types and how keys expire.
From there you'll get comfortable managing Redis from the console with redis-cli
(finding keys, inspecting values, flushing the cache), then wire Redis into a Laravel
app: as the cache, for sessions and for queues. The heart of the course is caching done
right - the cache-aside pattern, TTLs, and the part everyone underestimates: cache
invalidation, one of the genuinely hard problems in programming.
Every lesson builds on the previous one, with small, runnable commands and real config you can copy. By the end you'll cache a real application, invalidate it correctly, and run Redis in production without surprises.
It's written for developers who will actually use Redis day to day, not just read about it.
Course curriculum
- What is Redis? Redis is an in-memory key-value store. Learn what in-memory and key-value mean, and why Redis is so fast, in plain language for developers.
- What Redis is used for A quick map of what Redis is used for: caching, sessions, queues, rate limiting, and pub/sub. A plain overview for developers new to Redis.
- Redis vs a database Redis vs a traditional database like MySQL or Postgres. RAM vs disk, why Redis complements your database instead of replacing it, and when to use each.
- Run Redis with Docker Run Redis locally with Docker. Start a container with docker run, add a docker-compose service, open redis-cli, and verify with PING.
- Your first Redis commands Run your first Redis commands in redis-cli: PING to check the connection, SET and GET to store and read a value, and DEL to remove it.
- Keys and values Learn the Redis SET and GET commands: how storing and reading works, what overwriting a key does, and why every Redis key is just a string.
- Key naming conventions Name Redis keys with colon namespaces like user:42:profile. Learn the convention that keeps keys searchable, groupable, and easy to invalidate.
- Expiration and TTL Set Redis key expiration so keys delete themselves with EXPIRE, SETEX and SET EX. Read a key's TTL and remove expiry with PERSIST - the basis of caching.
- Deleting and checking keys Delete Redis keys with DEL, check them with EXISTS, rename with RENAME, and learn why KEYS can freeze a production server - use SCAN instead.
- Atomic counters Build race-free Redis atomic counters with INCR, DECR, INCRBY and DECRBY. Count page views safely under load and combine counters with EXPIRE.
- Strings Redis strings hold text, numbers, or JSON up to 512MB. Learn APPEND, STRLEN, and GETSET with copy-paste redis-cli examples built for developers.
- Hashes Redis hashes store many fields under one key, like an object or a row. Learn HSET, HGET, HGETALL, and HDEL with plain redis-cli examples for developers.
- Lists Redis lists are ordered collections you can drive as a queue or a stack. Learn LPUSH, RPUSH, LPOP, RPOP, and LRANGE with clear redis-cli examples.
- Sets Redis sets hold unique, unordered members and answer membership tests instantly. Learn SADD, SISMEMBER, SINTER, and SUNION with redis-cli examples.
- Sorted sets Build a Redis sorted set leaderboard: unique members ranked by score, kept sorted for you. Learn ZADD, ZRANGE, ZREVRANGE, ZSCORE, and ZRANK.
- The redis-cli console Connect to Redis with redis-cli: locally, in Docker, or a remote host. Learn the interactive prompt, one-shot commands, SELECT, and DBSIZE.
- Finding keys: SCAN vs KEYS How to list Redis keys by pattern. Why KEYS blocks production, how SCAN with MATCH and COUNT is the safe way, plus the redis-cli --scan shortcut.
- Inspecting keys and values Inspect any Redis key from the console: EXISTS, TYPE, TTL, OBJECT ENCODING, MEMORY USAGE, and how to read strings, hashes, lists, sets and sorted sets.
- How to delete keys and flush the cache in Redis Delete Redis keys with DEL and UNLINK, remove many by pattern, and delete all keys with FLUSHDB vs FLUSHALL. Plus the danger of flushing production.
- Server info and monitoring Watch a live Redis: read INFO memory and keyspace stats, stream commands with MONITOR, check SLOWLOG, and use --stat, --bigkeys, and --latency.
- Connecting Redis to Laravel Connect Redis to a Laravel 11 app: the redis config block, REDIS_HOST/PORT/PASSWORD env keys, phpredis vs predis, and a Redis::ping() check.
- Using the Redis facade Use the Laravel Redis facade to run raw commands: set, get, hset, del. Covers the default connection and the automatic REDIS_PREFIX on every key.
- Redis as the cache driver Make Redis your Laravel 11 cache store with one line, CACHE_STORE=redis. How the Redis cache driver differs from file and array, and why it uses its own database.
- Caching in Laravel Cache in Laravel with the Cache facade: remember, put, get, has, forget, flush, rememberForever, add, increment. The Cache::remember pattern, explained.
- Cache tags Group cache entries with Laravel cache tags and flush a whole group in one call. Why tags need a taggable store like Redis, with a real posts example.
- Sessions and queues on Redis Run Laravel sessions and queues on Redis with SESSION_DRIVER=redis and QUEUE_CONNECTION=redis. Why Redis fits both, plus dispatch and queue:work.
- Why we cache Why caching matters: do expensive work once, master the speed-versus-freshness trade-off, and learn what makes a good cache candidate in Redis.
- The cache-aside pattern The cache-aside pattern in Laravel: check the cache, compute on a miss, store, return - and why Cache::remember is this pattern in one line.
- TTL vs explicit invalidation TTL vs explicit cache invalidation in Laravel: let entries expire on a timer or clear them on change. When each is enough, and why you want both.
- Why cache invalidation is hard Why cache invalidation is hard, for real: stale reads, freshness vs correctness, copies scattered across layers, races, and knowing what to clear.
- Invalidation strategies Five cache invalidation strategies in Laravel: delete-on-write, write-through, cache tags, versioned keys, and model-event busting - with trade-offs.
- Cache stampede A hot cache key expires and every request rebuilds it at once, hammering the DB. Fix cache stampede with Cache::lock, jittered TTLs, and stale-while-revalidate.
- Common caching mistakes Five caching mistakes that bite in production: no TTL, per-user data under a shared key, over-caching, cached errors, and unbounded key growth.
- Rate limiting with Redis Build a fixed-window rate limiter with Redis rate limiting: INCR and EXPIRE per user, plus how Laravel's throttle middleware uses the same counter.
- Queues and background jobs Set up a Laravel Redis queue: dispatch background jobs, run queue:work, and retry failed jobs with queue:retry. Why Redis lists fit a queue.
- Publish/subscribe Learn Redis pub/sub with SUBSCRIBE and PUBLISH. Send fire-and-forget live messages to connected clients, and see how it differs from a persistent queue.
- Persistence: RDB and AOF Does Redis survive a restart? Learn how Redis persists in-memory data to disk with RDB snapshots and AOF, their trade-offs, and when a cache needs neither.
- Eviction policies Set a Redis memory limit with maxmemory and choose a maxmemory-policy. Compare noeviction, allkeys-lru, allkeys-lfu, volatile-lru, and volatile-ttl for a cache.
- Securing Redis Secure Redis the right way: set a password with requirepass or ACLs, bind to localhost, use protected-mode, and never expose port 6379 to the internet.
- A Laravel + Redis Docker stack A full annotated docker-compose.yml for Laravel with a php-fpm app, redis:7, and a queue worker - plus the .env wiring and how services find each other.
- Troubleshooting Redis Fix common Redis errors: Connection refused, NOAUTH, OOM maxmemory, WRONGTYPE, and slow commands - and diagnose them with INFO, MONITOR, and SLOWLOG.