Caching strategies

Recipes

Network or cache

The service worker in this recipe tries to retrieve the most up to date content from the network but if the network is taking too much, it will serve cached content instead.

Cache only

The recipe provides a service worker always answering from cache on fetch events.

Cache and update

The recipe provides a service worker responding from cache to deliver fast responses and also updating the cache entry from the network.

Cache, update and refresh

The recipe provides a service worker responding from cache to deliver fast responses and also updating the cache entry from the network. When the network response is ready, the UI updates automatically.

Embedded fallback

The recipe provides a service worker serving an embedded content fallback in case of missing resources.


Has it been useful?

Tell us what you think of this recipe by leaving a comment!