workbox-expiration
Classes
CacheExpiration
The CacheExpiration
class allows you define an expiration and / or
limit on the number of responses stored in a
Cache
.
ExpirationPlugin
This plugin can be used in a workbox-strategy
to regularly enforce a
limit on the age and / or the number of cached requests.
It can only be used with workbox-strategy
instances that have a
custom cacheName
property set.
In other words, it can't be used to expire entries in strategy that uses the
default runtime cache name.
Whenever a cached request is used or updated, this plugin will look at the associated cache and remove any old or extra requests.
When using maxAgeSeconds
, requests may be used once after expiring
because the expiration clean up will not have occurred until after the
cached request has been used. If the request has a "Date" header, then
a light weight expiration check is performed and the request will not be
used immediately.
When using maxEntries
, the entry least-recently requested will be removed
from the cache first.