Caches object
The Caches
object represents a collection of named caches and members to interact with those caches. The interface provides methods to open, create, iterate, and remove individual caches. You can also match cached responses over all the named caches without interrogating each one.
caches.open
The caches.open
method returns a reference to a cache matching the name that's supplied. This reference is a Cache
object, which is detailed in later sections. If a cache matching the name does not exist, a new cache is provisioned. This returns a promise; resolving a cache object allows you to manage cached responses in that cache:
caches.open(cacheName).then(function (cache) { //do something here });
caches.match
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...