[ServiceWorker] Hints in beforeevicted to let the SW of a web app pick among several house cleaning options? (#611)

I'm assuming that the intent of onbeforeevicted is to notify a Service Worker that the system is under storage pressure and is gently asking for freeing up resources before it wipes out all the Caches.

The beforeevicted event hasn't been spec yet but I was thinking about use cases. For instance, an app should know what's critical, vs. what's important, vs. what's secondary. Concretely, you can imagine that an airline app might decide to either shed away everything except what's needed to show an electronic boarding pass, or everything except what's needed to display hotel and directions as well as the electronic boarding pass.

A game might want to evict the bare minimum (e.g. completed game levels, high res assets...). Similarly, a video rental app might want to evict already watched episodes (1-3) and/or evict unseen episodes from the tail (the last 2 episodes, 7 and 8). 

Basically, if the event for a given SW had hints about how much pressure there is and how much this particular SW is contributing to it, a web developer could code an eviction strategy that offers the right balance between what is being asked while maintaining expected levels of user experience and minimizing the risk of being wiped-out (e.g. the user can still check-in with his electronic boarding pass, the user can still play new levels and watch new episodes of his favorite show on his flight).


Thoughts?



---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/611

Received on Thursday, 29 January 2015 09:12:21 UTC