Home / caching strategy mobile interview

Mobile system design

Caching strategy mobile interview

Caching questions test whether you can trade freshness against speed and availability deliberately, and whether you handle invalidation, the hard part.

The main strategies

Cache-first returns cached data immediately for speed and offline support, updating in the background. Network-first prefers fresh data and falls back to cache on failure, good for volatile content. Stale-while-revalidate shows cached data instantly, then refreshes and updates the UI, giving fast display with eventual freshness, which suits most feeds.

Invalidation and honesty

Discuss TTLs, explicit invalidation on writes, and versioned or ETag-based validation so you refetch only when data changed. Decide the layers: in-memory for the session, disk for persistence. Keep the UI truthful about stale data where it matters, for example a subtle refresh indicator. Naming that cache invalidation is the genuinely hard part shows maturity.

Go deeper than a summary

Share Your Screen works topics like this through in full: 75 solved Swift problems with tests, 9 real case studies, and 7 annotated mock interviews, so you rehearse the live round instead of just reading about it.

Get the book

Frequently asked

When would you use network-first over cache-first?

When freshness matters more than speed or offline support, such as balances or live status, falling back to cache only if the network fails.

What is stale-while-revalidate?

Show cached data immediately, then fetch fresh data in the background and update the UI when it arrives, combining fast display with eventual freshness.