workbox.routing.registerRoute( new RegExp('xy/xyzAPI/api'), workbox.strategies.staleWhileRevalidate({ cacheName: 'api-url', plugins: [ new workbox.expiration.Plugin({ maxEntries: 20, maxAgeSeconds: 24 * 60 * 60 }), new workbox.broadcastUpdate.Plugin('api-url', { headersToCheck: ['date'], }) ] }));
在插件中,请删除或减少工作盒过期时间
workbox.routing.registerRoute( new RegExp('xy/xyzAPI/api'), workbox.strategies.staleWhileRevalidate({ cacheName: 'api-url', plugins: [ new workbox.expiration.Plugin({ maxEntries: 20, }), new workbox.broadcastUpdate.Plugin('api-url', { headersToCheck: ['date'], }) ] }));