CacheFirst策略无法遵守maxAgeSeconds的到期时间

时间:2020-07-18 08:14:02

标签: service-worker workbox

已使用ExpirationPlugin的注册路由设置了Cache优先级路由,且maxAge为60,但它不起作用,始终会从缓存中获取api,并且永远不会从浏览器中退出缓存

workbox.routing.registerRoute(
    new RegExp('/api/orders/businessHoursByTimeZone/*'),
    new workbox.strategies.CacheFirst({
      cacheName: "business-timezones-cache",
      plugins: [
        new workbox.expiration.ExpirationPlugin({
            maxAgeSeconds: 60,
            maxEntries: 2
        }),
      ],
    })
);

0 个答案:

没有答案