Skip to content
RED SAGSkills
mediumFull Stack Developer interview question

Describe the different layers where you can cache in a typical full-stack web app, and how you keep cached data correct.

What the interviewer wants to hear

  • Browser cache controlled by Cache-Control and ETags
  • CDN or edge cache for public pages and static assets
  • Framework or server cache, such as Next.js data cache or Redis
  • Client-side data cache such as TanStack Query
  • Invalidation via TTLs, tags or events on write
  • Never share-cache personalized data

Model answer

I think of caching from the outside in. In the browser, Cache-Control and ETags let hashed assets be cached for a year and API responses be revalidated cheaply. A CDN caches static files and public pages close to users, often with stale-while-revalidate so updates appear quickly without slow misses. On the server, Next.js can cache rendered pages and fetched data, and Redis stores expensive query results or sessions using the cache-aside pattern. On the client, a library like TanStack Query caches API data and refetches in the background. To keep data correct, I pick TTLs based on how stale the data may be, and I invalidate on writes using tags, revalidatePath or deleting Redis keys after the database commit. The key rule is that anything personalized is marked private or no-store, so a shared cache never serves one user’s data to another.

Can you answer it under time pressure?

Take a timed medium round and get scored on every answer.

Start mock interview

More medium Full Stack Developer questions