Cache invalidation is handled by the Workbox Expiration plugin. This plugin allows you to control how many responses, lifetime, or a combination of both can be cached for a specific rule.
The expiration plugin is applied to the route's handler or caching strategy method. This is done by adding a new expiration plugin reference to the strategy's plugins array:
workbox.routing.registerRoute( new RegExp('/event/'), workbox.strategies.cacheFirst({ cacheName: 'events', plugins: [ new workbox.expiration.Plugin({ maxEntries: 20, maxAgeSeconds: 24 * 60 * 60 //1 day }) ] }) );
If you want to limit the number of cached responses for the rule, supply a numeric value for the maxEntries property. If you want to limit a responses ...