GoogleChromeLabs / sw-toolbox

[Deprecated] A collection of service worker tools for offlining runtime requests
https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw
Apache License 2.0
3.62k stars 332 forks source link

Cache with maxAgeSeconds option not expiring for cacheFirst strategy #279

Open nnagakarthikeyan opened 6 years ago

nnagakarthikeyan commented 6 years ago

In my localhost for a cacheFirst strategy if "maxAgeSeconds" option is set for the custom cache , it is never getting expired after the defined interval and always getting the old cached response.

Also made sure in my cached response the date header is present

Also the indexedDB contains the exact timestamp of the requested url.

Below is the sw-toolbox version detail

"sw-toolbox" : "^3.6.1"

Below is the sample code were the caching strategy is applied.

toolbox.router.get(/sam\/v1\/productDetails\/k-21225F91386049$/, toolbox.cacheFirst,{ cache: { name: 'product details cache', maxAgeSeconds: 5 } });