What’s a good event to trigger a clean-up?
Cache-limiting in Service Workers …again
Jeremy Keith

We added the “activate” event as a handy place to do cleanup work (including database migrations), so you should probably call it there.

That said, you seem to want to limit the total number, so I’d suggest adding a separate waitUntil() in your fetch handler and call trimCache() there.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.