Skip to content

OrderNot attempted

The cache layers

Order the cache layers a request passes through, from closest to the user to the source of truth.

Drag the rows, or use the arrows, to put them in order from first to last.

  1. Database / upstream API
  2. Next.js Data Cache (opt-in since Next 15: force-cache, next.revalidate, tags)
  3. Next.js Full Route Cache (prerendered HTML + RSC payload, revalidate)
  4. CDN / Edge cache (s-maxage)
  5. Browser cache (Cache-Control max-age)
Show answer & explanation

Correct order:

  1. Browser cache (Cache-Control max-age)
  2. CDN / Edge cache (s-maxage)
  3. Next.js Full Route Cache (prerendered HTML + RSC payload, revalidate)
  4. Next.js Data Cache (opt-in since Next 15: force-cache, next.revalidate, tags)
  5. Database / upstream API

Each layer can serve the request and stop it from reaching the next. Invalidation has to target the right layer: revalidateTag purges the data cache, and HTTP headers control browser/CDN behaviour.