Design a distributed Cache.

Medium
Company: Premium
GoogleAmazonUber

Let's refine our distributed cache design. Imagine you're building a caching system for a high-throughput e-commerce platform. You need a cache that's not only fast but also resilient and scalable. Forget the complexities of full-blown distributed systems; let's focus on the core cache implementation details within a single process, particularly around data structures, concurrency, and extensibility.

This problem challenges you to design and implement a thread-safe, in-memory distributed cache. We abstract away the network communication and focus on the core caching logic. Think of it as a building block for a larger distributed system. Your cache needs to support basic operations like put, get, and remove, but also more advanced features like expiration and eviction policies. We will emulate the "distributed" aspect through partitioning the keyspace using a simple hash function and simulating multiple cache nodes within the same process.

Requirements

Think like an Architect

Before revealing the requirements, imagine you're in the interview right now."How would you clarify the scope with your interviewer?"

Premium Content

View detailed solutions.

UNLOCK PREMIUM