serviceworker-cookbook/strategy-cache-update-and-r...
Salvador de la Puente González d18104feb9 Cache, update and refresh strategy 2016-10-05 17:33:27 +02:00
..
README.md Cache, update and refresh strategy 2016-10-05 17:33:27 +02:00
controlled.html Cache, update and refresh strategy 2016-10-05 17:33:27 +02:00
controlled.js Cache, update and refresh strategy 2016-10-05 17:33:27 +02:00
index.html Cache, update and refresh strategy 2016-10-05 17:33:27 +02:00
index.js Cache, update and refresh strategy 2016-10-05 17:33:27 +02:00
non-controlled.html Cache, update and refresh strategy 2016-10-05 17:33:27 +02:00
server.js Cache, update and refresh strategy 2016-10-05 17:33:27 +02:00
service-worker.js Cache, update and refresh strategy 2016-10-05 17:33:27 +02:00

README.md

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.

Difficulty

Intermediate

Use Case

You want to instantly show content while retrieving new content in background. Once the new content is available you want to show it somehow.

Solution

Serve the content from the cache but at the same time, perform a network request to update the cache entry and inform the UI about new up to date content.

Category

Caching strategies