The Cache-Then-Network Strategy

Understand how the cache-then-network strategy works and can be used in a project.

We'll cover the following

How it works

This strategy is an optimized version of the network-with-a-cache-fallback approach and eliminates the need for network timeouts. It requires the page to make two requests, one to the cache and one to the network. The idea is to show the cached data first, then update the page when/if the network data arrives.

Note: This strategy can only be implemented if the request is made manually from the page because we first manually access our cache.

The following slides illustrate this strategy:

Get hands-on with 1200+ tech skills courses.