Comments (4)
My current thinking, after experimenting a bit in the https://github.com/jeffposnick/gulp-sw-precache project:
- Define groups of resources:
- Generally, use glob patterns based on file extensions.
- Within the set of files that match a certain pattern, identify "volatile" files that are most likely to change and create a distinct group for those. E.g. all the
bower_components/**.js
files are unlikely to change, while thescripts/**.js
files are much more likely to.
- Each group of resources will be stored in an individual service worker
Cache
object. TheCache
will be named/versioned based on a combination of the group identifier + a hash of each file's contents. If any of the files that make up a group change, the entireCache
gets invalidated and all of the files in thatCache
will be refetched. - To prevent accidentally pulling down, e.g., 10MB of image data in the
install
handler when a user first visits a page, impose an upper limit on the size of each cache (likely: 1MB) as well as a limit on the number of files in each (likely: 100 files). This is more of a sanity check than anything else.
shed
doesn't offer flexibility with regard to naming and versioning individual caches, so we're going to have to go bare-metal service worker for the implementation.
from ioweb2015.
Is 1MB too small though? A few of the site's images alone will fill that up.
from ioweb2015.
I've been talking to some of the service worker eng. folks about this, and they confirmed that there's no technical reason why we can't maintain distinct, named caches for each individual resource. There might be a marginal slowdown when it comes to looking up entries, but we'd get the benefit of only expiring resources that change, without incurring the penalty of refetching unchanged resources that happened to be grouped together in the same cache.
I'm going to go with that approach, which is conceptually the same thing as what I implemented in https://github.com/jeffposnick/gulp-sw-precache, except that the group size would always be 1.
from ioweb2015.
FYI, I just added support for using a dedicated cache for each resource URL (GoogleChromeLabs/sw-precache@e7f91e7) and support for versioning server-generated resources based on all the component template files (GoogleChromeLabs/sw-precache@1e4aa51) into the gulp-sw-precache
project.
It seems to work there, and accomplishes everything we need (I think), so I'm now going to port it all into this project.
from ioweb2015.
Related Issues (20)
- [Homepage] Keynote video doesn't go full screen HOT 3
- Polymer video - default video loaded HOT 2
- Dev server failed for https request HOT 4
- Chrome IOS Site not usable
- Update promises polyfill to latest
- Schedule page: IE console errors for cannot call getLocalizedTime of null
- Schedule: page content doesnt slide in on page nav HOT 4
- Notifications: add vibrate option to notifications
- Notifications: record analytics for every showNotification HOT 1
- missing loader.js seems to prevent template rendering? HOT 10
- gulp build-experiment seems to be broken HOT 3
- Future experiement: template.async -> mutation observers
- 2015 recap video HOT 2
- Gulp setup fails HOT 3
- Firefox: Video Play Button "Watch the keynote" Buttons Broken
- Windows capability HOT 3
- gulp serve fails 'Error: `libsass` bindings not found. Try reinstalling `node-sass`?' HOT 4
- Google I/O 2016 Website issue HOT 2
- paper-drawer menu items not showing #194 HOT 1
- Entire website is broken
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ioweb2015.