July 2018
Intermediate to advanced
354 pages
8h 51m
English
The Invalidation Manager is a special module that handles implementing the maximum items and time to live invalidation strategies. The script is imported to the service worker using the importScripts method:
invalidationManager = new InvalidationManager([{
"cacheName": preCache,
"invalidationStrategy": "ttl",
"strategyOptions": {
"ttl": 604800 //1 week } }, { "cacheName": qrCodesCacheName, "invalidationStrategy": "maxItems", "strategyOptions": { "max": 10 } }]);
This module has a method called cacheCleanup, which loops over the set of invalidation rules that are supplied in the constructor, as shown earlier. As it loops through the rules, it executes each strategy against a named cache. The invalidation rules are ...
Read now
Unlock full access