Common Problems
Distributed Cache
Try This Problem Yourself
Practice with guided hints and real-time feedback
Understanding the Problem
Functional Requirements
- Users should be able to set, get, and delete key-value pairs.
- Users should be able to configure the expiration time for key-value pairs.
- Data should be evicted according to Least Recently Used (LRU) policy.
- Users should be able to configure the cache size.
Non-Functional Requirements
- The system should be highly available. Eventual consistency is acceptable.
- The system should support low latency operations (< 10ms for get and set requests).
- The system should be scalable to support the expected 1TB of data and 100k requests per second.
- Durability (data persistence across restarts)
- Strong consistency guarantees
- Complex querying capabilities
- Transaction support
The Set Up
Planning the Approach
Defining the Core Entities
The API
High-Level Design
1) Users should be able to set, get, and delete key-value pairs
2) Users should be able to configure the expiration time for key-value pairs
3) Data should be evicted according to LRU policy
Potential Deep Dives
1) How do we ensure our cache is highly available and fault tolerant?
2) How do we ensure our cache is scalable?
3) How can we ensure an even distribution of keys across our nodes?
4) What happens if you have a hot key that is being read from a lot?
5) What happens if you have a hot key that is being written to a lot?
6) How do we ensure our cache is performant?
Tying it all together
What is Expected at Each Level?
Mid-level
Senior
Staff
Purchase Premium to Keep Reading
Unlock this article and so much more with Hello Interview Premium
Track your interview readiness
Your personal checklist helps you know what to study and keep track of your progress.
View ChecklistOn This Page
Understanding the Problem
Functional Requirements
Non-Functional Requirements
The Set Up
Planning the Approach
Defining the Core Entities
The API
High-Level Design
1) Users should be able to set, get, and delete key-value pairs
2) Users should be able to configure the expiration time for key-value pairs
3) Data should be evicted according to LRU policy
Potential Deep Dives
1) How do we ensure our cache is highly available and fault tolerant?
2) How do we ensure our cache is scalable?
3) How can we ensure an even distribution of keys across our nodes?
4) What happens if you have a hot key that is being read from a lot?
5) What happens if you have a hot key that is being written to a lot?
6) How do we ensure our cache is performant?
Tying it all together
What is Expected at Each Level?
Mid-level
Senior
Staff
Schedule a mock interview
Meet with a FAANG senior+ engineer or manager and learn exactly what it takes to get the job.
