From d5e735b59ee522aba7ad8678c21091fd624cfecb Mon Sep 17 00:00:00 2001 From: Spythere Date: Wed, 27 Mar 2024 16:21:56 +0100 Subject: [PATCH] caching --- vite.config.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/vite.config.ts b/vite.config.ts index 6989713..1c9c4bf 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -36,6 +36,20 @@ export default defineConfig({ }, }, }, + { + urlPattern: /^https:\/\/static.spythere.eu\/.*/i, + handler: 'CacheFirst', + options: { + cacheName: 'spythere-api-images-cache', + expiration: { + maxEntries: 100, + maxAgeSeconds: 60 * 60 * 24, // <== 1 day + }, + cacheableResponse: { + statuses: [200, 302], + }, + }, + }, ], }, }),