- What is Redis?
- In-memory data store. Fast (sub-millisecond), supports strings, hashes, lists, sets, sorted sets, streams. Used for cache, session store, pub/sub, queues.
- Common data-type choices?
- String for KV cache. Hash for object fields (user:123 {name, email}). Sorted set for leaderboards and time-series. Stream for event logs.
- Caching pattern?
- Cache-aside: check cache, hit returns; miss → fetch from DB → store in cache. Set TTL on writes to avoid stale data. Use SETNX for distributed locks.
- What breaks in production?
- Memory exhaustion (no eviction policy set), connection pool saturation, blocking operations (KEYS on production). Always set maxmemory + policy, use SCAN not KEYS.