`expireEntries()` does not remove cache entries
Brought to you by:
tomkozak
Originally created by: kylemeenehan
Hi there! Thanks for the great library!
This was working before, with no change in version of workbox packages, so I'm wondering whether this is a change in Google Chrome or its underlying dependencies?
Currently I have some code that clears out a cache when a POST request is successful. It's been working fine until recently, but now when testing it appears to not clear the cache.
This is an excerpt of my code:
...
const searchExpiration = new CacheExpiration("tags-search", {
maxAgeSeconds: 60
});
registerRoute(
({ url, sameOrigin }) => {
return sameOrigin && url.pathname.includes("/api/v1/tags");
},
new NetworkOnly({
plugins: [
{
fetchDidSucceed: async ({ response }) => {
/**
* When we create a new tag, the data in the backend changes and we need
* to invalidate the local cache for the search queries.
*/
console.log('expiring entries for search')
searchExpiration.expireEntries();
...
redacted
...
return response;
}
}
]
}),
"POST"
);
...
I do see expiring entries for search in the console, so the route handler is happy, but the caches are still present in the "tags-search" cache after calling expireEntries().
Google Chrome version: Version 135.0.7049.115 (Official Build) (arm64)
Originally posted by: kylemeenehan
I've tried in Edge and Firefox and I get the same problem. Updated
workboxpackages from7.0.0to7.3.0and I still get the same problem. I'm trying to download an older version of Chromium, but it appears that these instructions are out of date: https://www.chromium.org/getting-involved/download-chromium/#downloading-old-builds-of-chrome-chromium