InterviewStack.io LogoInterviewStack.io
Interview Prep12 min read

Backend Developer Caching Interview: One TTL for Every Field?

A mid-level Backend Developer caching interview, turn by turn: where a single TTL costs points, and the blueprint a strong candidate hits in 30 minutes.

IT
InterviewStack TeamEngineering
|

The Backend Developer Distributed Caching Interview Rewards Field-by-Field Thinking

A mid-level Backend Developer walks into a 30-minute interview on distributed caching strategies. The premise sounds routine: put a cache in front of a slow database, cut latency, done. This walkthrough is built from a real InterviewStack.io AI-interview blueprint for exactly that scenario, and it is not a Redis trivia test. Most of the 100 points sit in what you do with the fields, not which product you name.

The trap shows up early and quietly. A candidate who treats the entire product object as one blob, one cache key, one TTL, one invalidation rule, looks fine for the first two minutes. Then every follow-up question gets harder than it needs to be, because the design never separated what actually needs to be fresh (price, inventory) from what can lag by an hour (a product description). That single decision in minute two shapes the rest of the interview.

Key Findings

  • The interview runs 30 minutes across four scored phases lasting 8, 10, 8, and 4 minutes.
  • The 100-point rubric splits 30/30/20/20 across Interviewer Objectives Alignment, Level-Specific Expectations, Technical Proficiency, and Communication.
  • The service has a hard P95 latency target under 120ms, served from stateless instances across 2 regions.
  • Phase 1 (minutes 0-8) carries 4 checklist items, and none of them require naming a specific cache technology.
  • Phase 2 (minutes 8-18) is the longest phase at 10 minutes, covering TTL differentiation, update-driven invalidation, consistency tradeoffs, and blob-vs-partial-key decisions together.
  • Phase 3 (minutes 18-26) tests 4 distinct failure patterns: stampede, hot keys, cache outage, and poor eviction behavior.
  • Phase 4 (minutes 26-30) closes with a 3-item checklist on metrics, alerts, and a prioritized summary, in just 4 minutes.

Backend Developer distributed caching interview rubric weights across four dimensions Level-Specific Expectations and Interviewer Objectives Alignment together hold 60 of the 100 points, three times the weight of Technical Proficiency or Communication on their own.

Meet the Scenario

The interview question

You're the backend developer on a product details service for a large e-commerce app. It backs both the mobile app and the web storefront, and every product page renders through one endpoint.

GET /products/{product_id}

Product metadata lives in a primary relational database. The endpoint is read-heavy, with sharp traffic spikes during promotions, and the database team already reports sustained read pressure. Product data changes occasionally: price updates, inventory changes, merchandising edits, and new launches. Some fields matter more than others: inventory and price need to stay fresh, long-form descriptions can lag. The service runs as stateless instances across two regions, the P95 latency target is under 120ms, and if the cache ever goes down, the product page still has to load while the database stays protected. How would you design the caching strategy?

The interviewer isn't grading whether you've heard of Redis. They're watching whether you can place a distributed cache correctly, reason about consistency and invalidation, anticipate stampedes and hot keys before they happen, and back every choice with a measurable goal like latency, hit rate, or database load, not a memorized pattern name.

Where Does a Backend Developer Actually Lose Points on Caching?

Four follow-ups from the real interview package carry most of the signal. Here's how a candidate named Felix handles them, and where a mid-level bar actually sits.

Turn 1: Choosing what to cache

Interviewer: "What data would you cache, at which layer or layers, and what would you avoid caching?"

COMMON MISTAKE
Felix jumps straight to "I'll put a distributed cache in front of the database and cache the whole product object" without asking how often prices change or which fields actually need to be fresh. That skips the Phase 1 checklist item requiring the candidate to distinguish freshness needs between fields like price and inventory versus description and media metadata.
STRONGER MOVE
Before writing a single cache key, split the product object by freshness: price and inventory in one group, description and media in another. That split is what makes every later decision (TTL length, invalidation trigger, even which layer to cache at) tractable instead of one blanket rule applied everywhere.

Turn 2: Stopping stale prices

Interviewer: "How would you handle product updates so that users do not see stale price or inventory for too long?"

COMMON MISTAKE
Felix's fix for staleness is "set a 5-minute TTL on the whole object and move on." That treats an expiry timer as the invalidation strategy, which never satisfies the checklist item requiring an update-driven refresh or invalidation mechanism tied to actual product change events.
STRONGER MOVE
TTL is a safety net, not the strategy. Have the update path (a price change, an inventory update, a merchandising edit) actively invalidate or refresh the specific keys it touches, then use TTL underneath as a bound on staleness if an invalidation is ever missed. Price and inventory keep a short backup TTL; descriptions can carry a much longer one.

This is the turn the whole interview pivots on. Everything Felix skipped in Turn 1 (splitting fields by freshness) comes due here, because you cannot write a sane invalidation rule for a blob you never broke apart.

Turn 3: Surviving a promotion expiry wave

Interviewer: "If many cached entries expire at the same time during a promotion, how would you prevent a thundering herd against the database?"

COMMON MISTAKE
Felix's answer to a promotion-driven mass expiry is "the cache will just refill itself." With thousands of keys expiring in the same window, that refill means thousands of simultaneous database queries landing at once, exactly the thundering-herd failure the Phase 3 checklist calls out, and the scenario explicitly says the database must stay protected.
STRONGER MOVE
Add jitter to TTLs so expirations spread out instead of clustering, and use request coalescing (a single in-flight rebuild per key, with other readers waiting on that one result) so a hot key never turns into many simultaneous database hits. A soft TTL or stale-while-revalidate pattern buys extra headroom during a promotion spike.

Turn 4: Proving the cache is working

Interviewer: "What metrics, alerts, and operational safeguards would you put in place to know whether the cache is helping or hurting?"

COMMON MISTAKE
Asked how anyone would know the cache is helping, Felix says "we'd keep an eye on the cache dashboard." That's not a metric, and it misses the checklist item asking for concrete signals like cache hit rate, P95 latency, and database QPS, the exact numbers that would show the cache is failing before customers notice.
STRONGER MOVE
Name the signals directly: cache hit rate, P95 latency on the endpoint, database QPS as the protection metric, cache error rate, eviction rate, and hot-key concentration. Alert on a hit-rate drop paired with a database QPS spike, since that combination is the one that actually threatens the 120ms target.

Reading This Isn't the Same as Doing It Live

Every mistake above is easy to spot on a page, with no clock running and no interviewer waiting on your next sentence. Live, under 30 minutes, with follow-ups you haven't seen coming, the one-TTL trap and the thundering-herd gap are exactly the kind of thing a prepared candidate still walks into. Recognizing a mistake in someone else's transcript and avoiding it yourself, in the moment, are different skills. The second one only comes from reps.

What Does a Passing Answer Actually Include?

The 30-minute Backend Developer distributed caching interview blueprint across four phases Each phase's checklist has to land inside its window, from an 8-minute framing phase through a 10-minute consistency phase, an 8-minute resilience phase, and a 4-minute close.

This is the blueprint a strong candidate hits, phase by phase, and it's the exact structure the AI mock interview tracks you against in real time as you answer.

Blueprinta strong 30-minute interview, phase by phase
1
Problem framing and baseline cache design 0-8
  • Asks or states assumptions about read/write ratio, request volume, and update frequency
  • Distinguishes fields with different freshness needs such as price/inventory vs description/media metadata
  • Proposes a distributed cache in front of the database and explains why local in-memory cache alone is insufficient across many instances/regions
  • Selects an initial cache access pattern such as cache-aside and describes request flow on hit and miss
2
Consistency, invalidation, and TTL decisions 8-18
  • Explains TTL choices with different durations or strategies for different product attributes or cache objects
  • Describes at least one update-driven invalidation or refresh mechanism, such as deleting/updating cache on product change events
  • Acknowledges consistency tradeoffs and avoids claiming strict correctness from cache alone
  • Discusses whether to cache full product blobs, partial objects, or separate keys for highly volatile fields
3
Resilience under spikes and cache failure 18-26
  • Mentions stampede or thundering-herd prevention such as request coalescing, single-flight, jittered TTLs, background refresh, or soft TTLs
  • Identifies hot-key risk and proposes practical mitigation such as local short-lived cache, replication/read scaling, or selective prewarming
  • Explains fallback behavior when cache is down or miss rate spikes, including rate limiting, stale-if-error, or circuit breaking to protect the database
  • Shows awareness of cache memory/eviction behavior and the impact of poor key design or oversized values
4
Observability and final tradeoff summary 26-30
  • Names concrete metrics such as cache hit rate, p95 latency, DB QPS, cache error rate, evictions, and hot-key concentration
  • Suggests alerts or dashboards tied to user impact and backend protection
  • Summarizes the chosen design and its main tradeoffs in a concise, prioritized way

Practice This Exact Scenario

You've now watched four ways to lose points on this exact question. The only way to find out if you'd catch them live, with the clock running and no page to scroll back through, is to run the interview yourself. Start the AI mock interview on distributed caching strategies and get turn-by-turn, rubric-based feedback the moment you finish.

If you want to drill the underlying concepts first, cache-aside versus write-through, invalidation patterns, hot-key mitigation, before taking the full interview, the distributed caching question bank breaks the topic into individual questions. For broader Backend Developer interview prep, browse the preparation guides.

FAQ

Q. What does a mid-level Backend Developer distributed caching interview actually score?

The rubric is worth 100 points across four dimensions: 30 for Interviewer Objectives Alignment (did you solve the actual caching problem), 30 for Level-Specific Expectations (did you show a mid-level 2-5 year bar of judgment), 20 for Technical Proficiency, and 20 for Communication and Problem Solving.

Q. Why is one TTL for an entire cached product object a mistake?

Because price and inventory need to be fresher than a product description, a single TTL either makes the volatile fields too stale or forces the stable fields to be rebuilt far more often than necessary. The interview's Phase 1 checklist explicitly rewards separating fields by freshness need before choosing a caching pattern.

Q. How do you prevent a thundering herd when a promotion causes many cache entries to expire at once?

Jitter TTL expirations so they do not all land in the same second, use request coalescing so only one request rebuilds a given key while others wait, and consider a soft TTL or stale-while-revalidate pattern so the database only sees one rebuild query per hot key, not thousands.

Q. What happens if a single product goes viral and its cache key becomes extremely hot?

A distributed cache alone does not fully solve a hot key; the interview rewards recognizing the risk and proposing practical mitigation such as a short-lived local in-memory cache in front of the distributed cache, read replication, or selective prewarming, on top of the same coalescing used for expiry stampedes.

Q. What metrics should a Backend Developer name when asked how to operate the cache?

Cache hit rate, P95 latency on the endpoint, database QPS as the signal that protects the database, cache error rate, eviction rate, and hot-key concentration. The interview's final phase specifically checks for concrete, named metrics rather than a general "we would monitor it" answer.

Q. Is cache-aside always the right access pattern for a read-heavy service like this?

Not automatically. Cache-aside is a reasonable default for a read-heavy, occasionally-updated service like this product endpoint, but a strong mid-level answer explains why, versus read-through (simpler application code) or write-through and write-behind (better write-path guarantees, more complexity), rather than naming a pattern without reasoning.

Q. How long does the mock interview run and how many follow-up questions does it include?

The scenario runs 30 minutes across four phases of 8, 10, 8, and 4 minutes, moving from baseline design to consistency and invalidation, to resilience under load, to observability and summary, with the interviewer working through six scripted follow-up prompts across those four phases.

Freshness Is a Decision, Not a Default

The candidates who do well on this question never treat "cache it" as one decision. They treat it as several: which fields, at what layer, refreshed how, protected against what. That's the actual skill a distributed caching interview is checking for, and it's the one that only sharpens with a real clock running against you.

Topics

backend developer interviewdistributed cachingrediscache invalidationsystem design interviewmock interview prep

Ready to practice?

Put what you've learned into practice with AI mock interviews and structured preparation guides.