0
Challenge · 47Interview Gauntlet

The caching model, end to end

Cachingused in ~92% of apps

Caching is the single most common reason a Next.js app ships wrong data — or refuses to. Interviewers probe this because the App Router has FOUR distinct caches that hand a request off to each other, and most candidates can only name one. If you can trace a request through all four and say exactly where stale data is born, you read as senior. If you can't, every freshness bug becomes a guessing game.

Core idea. A request flows through four caches in order — Router Cache (client) → Full Route Cache (server) → Data Cache (server) → Request Memoization (per-render). In Next.js 16 nothing is cached at request time unless you opt in with `"use cache"`; you then control freshness per route with `cacheLife`, and invalidate with `revalidateTag` (SWR) or `updateTag` (read-your-writes).
Playground, this isn't a screenshot
<ViewCount />no data yet
—

Press Visit to mount the component.

SWR CACHE (key: /views)
(empty)
SERVER (live, drifts)
1,280
visits: 0
// SWR activity log…

First visit blocks on the network. Every visit after serves the cached (stale) value instantly, then revalidates in the background and swaps in fresh data — that is the whole name made literal.

↑ play a little first, then dig in