Redis is one implementation choice#
Redis often appears in interviews because it offers in-memory access, keys with expiration, configurable memory eviction, and data structures useful for shared caches, counters, rate limits, rankings, and coordination.
Redis is one possible implementation choice. The caching concepts in this section are not Redis-specific.
| Concept | Redis bridge | Question to ask |
|---|---|---|
| Cache identity | Keys and typed values | How is tenant, version, or variant encoded? |
| Freshness | Key expiration / TTL | What stale window is acceptable? |
| Capacity | Memory limit and eviction policy | Which entries should survive pressure? |
| Availability | Replication and high-availability options | What happens during failover and lag? |
| Scale | Cluster partitioning at high level | How are multi-key access and hot keys handled? |
| Durability | Optional snapshots and append-only logging | What data loss and recovery contract is required? |
Redis is not only a cache#
Strings, hashes, sets, sorted sets, counters, and other structures can support session state, leaderboards, rate limiting, and coordination. Pub/Sub and streams exist, but they belong to later messaging and Redis deep-dive lessons.
Persistence also exists, so “in memory means never durable” is too simplistic. Conversely, enabling persistence does not automatically make Redis equivalent to the durable primary database required by every product. Topology, acknowledgement, replication, backup, and recovery objectives still decide the contract.
- Using “Redis” as a complete caching strategy.
- Assuming one Redis topology, one durability mode, or one eviction policy.
- Falling back to the database without proving its capacity.
- Storing unlimited large values without a memory and eviction budget.
Use these prompts to extend the design. The useful answer is a reasoned change, not a memorized sentence.
- Which data structure and key design fit the access pattern?
- What memory limit and eviction behavior are required?
- Is persistence needed, and what loss window is acceptable?
- How do failover, a hot key, and a cold restart affect the source?
The dedicated Redis Technology Deep Dive remains separate; this lesson only maps caching decisions to Redis capabilities.
Related practice problems
Use the manifest-backed prompts below to apply this lesson in a complete design.
- Key evictionRedis Documentation
- EXPIRE commandRedis Documentation
- Redis persistenceRedis Documentation
- Redis replicationRedis Documentation