Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ampAssetsCaching() {
// Versioned Assets
router.registerRoute(
VERSIONED_ASSETS_RE,
new CacheFirst({
cacheName: VERSIONED_CACHE_NAME,
plugins: [
new Plugin({
maxAgeSeconds: 14 * 24 * 60 * 60, // 14 days
}),
],
}),
);
// Unversioned runtimes
router.registerRoute(
UNVERSIONED_RUNTIME_RE,
new StaleWhileRevalidate({
cacheName: UNVERSIONED_CACHE_NAME,
plugins: [
new Plugin({
maxAgeSeconds: 7 * 24 * 60 * 60, // 7 days
}),
],
cacheName: UNVERSIONED_CACHE_NAME,
plugins: [
new Plugin({
maxAgeSeconds: 7 * 24 * 60 * 60, // 7 days
}),
],
}),
);
// Unversioned Extensions
router.registerRoute(
UNVERSIONED_EXTENSIONS_RE,
new StaleWhileRevalidate({
cacheName: UNVERSIONED_CACHE_NAME,
plugins: [
new Plugin({
maxAgeSeconds: 24 * 60 * 60, // 1 day
}),
],
}),
);
}