July 2018
Intermediate to advanced
354 pages
8h 51m
English
The caches.match method is a convivence method that works similarly to the cache.match method. It returns a promise that resolves to the first cached response matching the Request object passed to the method.
The nice thing about the caches.match method is how it handles interrogating all named caches for a match. It returns the first match it finds.
This means that if matching responses are stored in different caches, you have no control over which response is found. To avoid a scenario where an invalid response is matched, you need to ensure that your logic invalidates outdated cached responses before caching an update:
return caches.match(request)
.then(function (response) {
return response;
})
Read now
Unlock full access