AI & Technical question

Design an in-memory cache system.

Practice this question out loud. An AI interviewer asks it, follows up like a real interviewer would, and scores your answer. Type or speak.

Start a mock interview on this question · Mock interview from a job description

What this question tests

Tests systems design fundamentals: eviction policy, consistency trade-offs, and how you'd measure cache effectiveness.

How to approach it

  1. Clarify use case and scale: a read-heavy lookup cache, confirm expected QPS and data size.
  2. Choose the data structure: a hash map for O(1) lookup, backed by a doubly linked list for LRU eviction.
  3. Decide the eviction policy: LRU by default, note LFU if access is skewed toward a few hot keys.
  4. Address consistency: a TTL plus write-through or write-invalidate so the cache doesn't serve stale data.
  5. Address scale: sharding across cache nodes with consistent hashing if one node isn't enough.
  6. Define measurement: cache hit rate and p99 latency, with a target hit rate stated as an assumption.

What a strong answer includes

Common mistakes

Likely follow-up questions

More ai & technical questions

More questions from Meta

Learn the skill behind it

Chapters of the AI PM course that teach what this question tests.

Preparing for a specific role?

Book summaries for this kind of question

Browse all 4,000+ questions in the bank