Skip to content

expireEntries() does not remove cache entries #3411

Open
@kylemeenehan

Description

@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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions