Design a Distributed Cache
Design a distributed caching system like Redis or Memcached that can handle millions of requests per second.
Solution Overview
Redis uses in-memory hash tables with persistence via RDB snapshots or AOF logs. Skip lists provide O(log n) operations. Pub/Sub pattern for real-time messaging. Multiple data structures: strings, lists, sets, sorted sets, hashes.
Architecture Pattern
In-memory data structure store with persistence and pub/sub
Key Concepts
Used By Companies
Redis uses in-memory hash tables with persistence via RDB snapshots or AOF logs. Skip lists provide O(log n) operations. Pub/Sub pattern for real-time messaging. Multiple data structures: strings, lists, sets, sorted sets, hashes.
Research consistent hashing
How do you handle hot keys?
Consider cache invalidation strategies
- •Uber
- •Shopify
- •Hash Tables
- •Skip Lists
- •Replication
- •Lua Scripting
- •AOF
https://github.com/codecrafters-io/build-your-own-x#build-your-own-redis