[whatwg] Improvement of the Application Cache
Edward Gerhold
edward.gerhold at googlemail.com
Sun Mar 6 13:05:44 PST 2011
2011/3/3 Michael Nordman <michaeln at google.com>
> Sounds like there are at least two feature requests here...
>
> 1) Some way of not adding the 'master' entry to the cache. This is a common
> feature request, there's another thread about it specificially titled
> "Application Cache for on-line sites".
>
I got an idea for the keyword. To make it easier for Ian to formulate that.
Adding the Master File not to the CACHE.
Write
CACHE MANIFEST NOMASTER
on the first line of the manifest.
or
If you enter the master filename in the whitelist section, it is simply
CACHE MANIFEST
NETWORK:
/index.php
If the master file is cached, but needs to be updated.
applicationCache.update(0); or applicationCache.updateMaster();
If you want to look for entries in the cache. Maybe you want to look for,
wheter you need update the cache, because you got a newer version for the
cache, or not, because the file is not in the cache.
applicationCache.entries[]
You can access the entry over the index number. Easier is using
applicationCache.getEntry(indexNum)
Then there is
applicationCache.setEntry(url)
applicationCache.setEntry(url, data) where data shall be HTML or other UTF-8
web standard and is possibly open to malicious code without any prior
checking of the "data" with the html, css or script parser for validity (if
that would run, if it is unchecked, i do not know so much about this).
applicationCache.setEntry(indexNum, data) would overwrite the content of the
file under indexNum keeping the url.
With that generated content from scripts can become cached easily.
Methods to add and remove files
applicationCache.add(url) returns index number (maybe an add(url, indexNum)
maybe not)
applicationCache.remove(indexNum) or application.cache.remove(url) returns
true or false
Maybe you see other return values
applicationCache.update(url or indexNum) returns true if, false if not
For
applicationCache.update(url);
The expiration of the cache is another topic, i expect, that you already
have heard a lot about, i think i come to the same conclusion than the most
of the programmers after a while. Maybe there should some timestamp be used,
the system time
in milliseconds would be very easy to be transformed or calculated. I have
not added these parameters now, i think that
would be a suggestion of somebody else, because i could live with this, i
could program expiration together with the app
and save dates. (Like i could use filesystem, i remember, thanks for the
advice again in advantage ;-))
I think that is all. I can not send a diff of the spec together with in, i
can´t so much.
But i hope to make it visible for all of you again.
I think that is most of the stuff i would like to have and how it behaves
again. I´ve read about alternatives and that there
is the "Programmable HTTP Caching and Serving" Working Draft existing, too,
which would be another solution to it,
but i would like to let you all read it again. Extending the application
cache with these few additions would make it better.
Edward
Edward
More information about the whatwg
mailing list