InterviewLegend

Design a Simple Cache

Frequently asked
Alex Chen22 min readGuide updated

This came up in a Bank of America software engineer loop in Hyderabad in November 2025, and that candidate got the offer. The loop opened with an online test of DSA and problem solving. Round one was DSA plus SQL. Round two covered software fundamentals: OOP, operating systems, databases and networking. The cache question sat in that second round, as one of its main questions. So pitch it the way the round is pitched. A campus or junior candidate doesn't need a distributed cluster with consistent hashing here. The interviewer wants to hear that you know what a cache is for, how it decides what to keep, and what goes wrong when the data underneath changes. Plan on ten to fifteen minutes of talking, with a short sketch of the data structure and maybe a few lines of code.

Start by saying why a cache exists at all. Reading a row from a database means a network hop and a disk or buffer lookup, often a few milliseconds. Reading a value from a map in the same process takes well under a microsecond. If the same few thousand keys get read over and over, keeping them in memory saves almost all of that time and takes load off the database. The catch is that memory is limited and the copy can go stale. Every design decision in this lesson answers one of those two problems. Eviction decides what to throw out when the cache is full. Expiry and invalidation decide when a cached copy is no longer true.

The Bank of America angle
This question arrived in a round on software fundamentals, next to OOP, operating systems and databases. Tie your answer to those subjects on purpose: the map and list are data structures, the locking is operating systems, and invalidation is a database question. That shows the interviewer you see the connections.

Bank of AmericaPremium lesson · System design round

The Bank of America design, worked end to end.

  1. Requirements and scopeSystem design · Frequently asked
  2. The API and data model
  3. The design, drawn out1 diagram
  4. 4 deep divesWith the tradeoffs
Get the Bank of America questions

$49 a year · all 108 companies · instant access

20,000+ candidate reports

Bank of America interview guide

Know what Bank of America asks before you walk in.

32 coding · 5 system design · 43 behavioral questions

Get Premium$49 a year · Instant access
Or start freeNo card.

Get their questions first.

Had your Bank of America interview?How we research

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.