Closed jakearchibald closed 10 years ago
My proposal is to put them in a LevelDB – x-platform and very Node-y.
Cool. If the caches can't be explored on disk it'd be great to have a url to inspect them (future idea, of course).
Actually, since there's programmatic cache access, this could be written as a separate project, built with a ServiceWorker. On 9 Jan 2014 12:20, "Tom Ashworth" notifications@github.com wrote:
My proposal is to put them in a LevelDB – x-platform and very Node-y.
— Reply to this email directly or view it on GitHubhttps://github.com/phuu/serviceworker-demo/issues/19#issuecomment-31925613 .
So, more thinking about this:
http-google-com.json
[
{
"name": "shell-v2",
"items": {
"some-url": { ... }
}
},
{ "name": "contents-v2", "items": { ... } },
...
]
Cache#has
? Only if definitely written.More thinking, new data structure schema:
/*
caches/
origin/
cache-xyz789.json
bodies/
body-123abc.json
*/
// cache-xyz789.json
{
items: [{
state: 'pending/fulfilled/rejected',
request: { ... },
resonse: {
... ,
body: 'body-123abc'
}
}]
}
// body-123abc.json
{
body: [123, 456, 789]
}
/*
cache-lists/
some-origin.json
*/
// some-origin.json
{
caches: [{
name: 'app-cache',
id: 'cache-xyz789'
}]
}
For the sake of the polyfill, garbage collecting caches when the worker is shut down is fine
…put them somewhere smarter. Probably just a directory.
Need to make sure they're cleaned up or reused when serviceworker restarts.