Redis Tutorial
Course Contents
Redis Fundamentals
- Redis Introduction
- Installing Redis
- Redis Get Started (redis-cli)
- How Redis Works: In-Memory and Single-Threaded
- Redis Data Types Overview
- Keys and the Keyspace
Strings
- SET and GET
- String Expiration (EX, PX, EXAT)
- Atomic Counters: INCR and DECR
- APPEND and String Length
- GETSET and Conditional Set (NX, XX)
- MSET and MGET
Key Management
- DEL, EXISTS, and TYPE
- Expiring Keys: EXPIRE and TTL
- Persisting Keys: PERSIST
- Renaming and Scanning Keys
- Why KEYS Is Dangerous in Production
Lists
- Lists Explained
- LPUSH, RPUSH, and LRANGE
- LPOP and RPOP
- Using Lists as Queues and Stacks
- LINDEX, LSET, and LLEN
- Blocking List Operations (BLPOP, BRPOP)
Hashes
- Hashes Explained
- HSET, HGET, and HGETALL
- HDEL and HEXISTS
- Incrementing Hash Fields (HINCRBY)
- Modeling Objects with Hashes
Sets
- Sets Explained
- SADD, SMEMBERS, and SREM
- Set Operations: SINTER, SUNION, SDIFF
- SISMEMBER and Set Cardinality
- Using Sets for Tags and Unique Tracking
Sorted Sets
- Sorted Sets Explained
- ZADD and ZRANGE
- ZSCORE and ZRANK
- ZINCRBY and Leaderboards
- ZRANGEBYSCORE and Range Queries
- ZREM and Removing Members
Expiration and Caching Patterns
- Redis as a Cache
- Cache-Aside Pattern
- Cache Invalidation Strategies
- Choosing TTLs and Avoiding Thundering Herds
Transactions and Scripting
- Redis Transactions: MULTI and EXEC
- WATCH and Optimistic Locking
- Introduction to Lua Scripting (EVAL)
- Why Redis Commands Are Atomic
Pub/Sub
- Publish/Subscribe Explained
- SUBSCRIBE and PUBLISH
- Pattern Subscriptions (PSUBSCRIBE)
- Pub/Sub Limitations and When to Use Streams Instead
Redis Streams
Persistence and Durability
Replication and High Availability
Redis with Application Code
- Connecting to Redis from Node.js
- Connecting to Redis from Python
- Connection Pooling
- Rate Limiting with Redis
- Session Storage with Redis
- Distributed Locks with Redis
