Deleting Cached items
You are also responsible for periodically purging cache entries. The browser will not invalidate cache for you. It might purge items if available space becomes limited. However, I would not worry about this scenario. Instead, you need a plan to delete cached assets so that you can control how long an item is cached for.
The best way to manage or invalidate cached assets is to apply a set of rules to control your cache. Chapter 8, Applying Advanced Service Worker Cache Strategies, goes into more detail about invalidation strategies. Before you reach that level, it's important to know how to remove an asset or delete an entire cache.
The delete method returns a promise that resolves true if a matching response was found ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access