javascript - How Service worker prevent 'fetch' from consuming too much disk space? -
may know strategy can used prevent addeventlistener('fetch'
&& cache.put(
filling user's disk space? there anyway set expirary each request in cache?
according service worker spec:
the cache objects authors have manage themselves. cache objects not updated unless authors explicitly request them be. cache objects not expire unless authors delete entries.
note the browser can throw cache away if wants (and should assume will), if decides you're storing - it's not going let fill user's entire drive.
there not appear methods examining size of cache either. note there related specifications in works, example quota management api. article jake archibald linked above gives following example of using api (which give result all site storage, not caches):
navigator.storagequota.queryinfo("temporary").then(function(info) { console.log(info.quota); // result: <quota in bytes> console.log(info.usage); // result: <used data in bytes> });
however tried in chrome canary , storagequota
undefined - don't think implemented anywhere yet. correct me if i'm wrong.
Comments
Post a Comment