Skip to content

Instantly share code, notes, and snippets.

@MrPeker
Last active January 27, 2019 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrPeker/e1ba598b455358d2b73dd887d046a64a to your computer and use it in GitHub Desktop.
Save MrPeker/e1ba598b455358d2b73dd887d046a64a to your computer and use it in GitHub Desktop.
Cache Images Workbox
// Cache First stratejisiyle resimlerinizi önbellekleyin
workbox.routing.registerRoute(
/\.(?:png|gif|jpg|jpeg|svg)$/,
workbox.strategies.cacheFirst({
cacheName: 'images',
plugins: [
new workbox.expiration.Plugin({
maxEntries: 60,
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 Gün
}),
],
}),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment