mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-21 08:45:32 +03:00
Workbox expiration plugin not working as expected
This commit is contained in:
parent
ad7193d067
commit
b3681a93ee
1 changed files with 21 additions and 18 deletions
39
public/sw.js
39
public/sw.js
|
@ -96,24 +96,27 @@ const apiExtendedRoute = new RegExpRoute(
|
|||
);
|
||||
registerRoute(apiExtendedRoute);
|
||||
|
||||
const apiIntermediateRoute = new RegExpRoute(
|
||||
// Matches:
|
||||
// - trends/*
|
||||
// - timelines/link
|
||||
/^https?:\/\/[^\/]+\/api\/v\d+\/(trends|timelines\/link)/,
|
||||
new StaleWhileRevalidate({
|
||||
cacheName: 'api-intermediate',
|
||||
plugins: [
|
||||
new ExpirationPlugin({
|
||||
maxAgeSeconds: 1 * 60, // 1min
|
||||
}),
|
||||
new CacheableResponsePlugin({
|
||||
statuses: [0, 200],
|
||||
}),
|
||||
],
|
||||
}),
|
||||
);
|
||||
registerRoute(apiIntermediateRoute);
|
||||
// Note: expiration is not working as expected
|
||||
// https://github.com/GoogleChrome/workbox/issues/3316
|
||||
//
|
||||
// const apiIntermediateRoute = new RegExpRoute(
|
||||
// // Matches:
|
||||
// // - trends/*
|
||||
// // - timelines/link
|
||||
// /^https?:\/\/[^\/]+\/api\/v\d+\/(trends|timelines\/link)/,
|
||||
// new StaleWhileRevalidate({
|
||||
// cacheName: 'api-intermediate',
|
||||
// plugins: [
|
||||
// new ExpirationPlugin({
|
||||
// maxAgeSeconds: 1 * 60, // 1min
|
||||
// }),
|
||||
// new CacheableResponsePlugin({
|
||||
// statuses: [0, 200],
|
||||
// }),
|
||||
// ],
|
||||
// }),
|
||||
// );
|
||||
// registerRoute(apiIntermediateRoute);
|
||||
|
||||
const apiRoute = new RegExpRoute(
|
||||
// Matches:
|
||||
|
|
Loading…
Reference in a new issue