Generating module.cache.js instead of module.nocache.js

149 views
Skip to first unread message

Alexander Orlov

unread,
Sep 16, 2011, 5:40:49 AM9/16/11
to google-we...@googlegroups.com
The default behavior of GWT is to generate the module.nocache.js versions. But how can I generate a module.cache.js version of a module? I've found some information about this issue but it seems to be obsolete. Also what does cache.js mean exactly? Can't I achieve the same result by adding *.nocache.js to HTML5's App Cache?

Thomas Broyer

unread,
Sep 16, 2011, 6:00:59 AM9/16/11
to google-we...@googlegroups.com
*.cache.* and *.nocache.* are just naming conventions adopted by GWT to help setup the "perfect caching" configurations.

If you enable caching for the *.nocache.js file, then you explicitly allow intermediate servers/proxies, and browsers, to serve/use a possibly obsolete version of you app, without necessarily checking for a fresher on at your server. That means your servlets have to be prepared receiving requests from such versions even after you pushed an update to your server.

Alexander Orlov

unread,
Sep 16, 2011, 6:58:57 AM9/16/11
to google-we...@googlegroups.com


On Friday, September 16, 2011 12:00:59 PM UTC+2, Thomas Broyer wrote:
*.cache.* and *.nocache.* are just naming conventions adopted by GWT to help setup the "perfect caching" configurations.

Really useful insights!
 

If you enable caching for the *.nocache.js file, then you explicitly allow intermediate servers/proxies, and browsers, to serve/use a possibly obsolete version of you app, without necessarily checking for a fresher on at your server. That means your servlets have to be prepared receiving requests from such versions even after you pushed an update to your server.

That's also what I had in mind. I just wondered why so many Google apps use the *.cache.js version. Ok, if the content ist pretty static and for a very high number of reqs/s it may be a viable solution.

Thomas Broyer

unread,
Sep 16, 2011, 9:32:14 AM9/16/11
to google-we...@googlegroups.com
AFAICT, most Google Apps do on the server side what the *.nocache.js does on the client side in a "default" setup (i.e. choose the right permutation, i.e. the right *.cache.* file, to load for a given user agent, locale, whatever combination).
They use the xsiframe (or actually probably a custom linker, similar to xsiframe) that generates *.cache.js instead of *.cache.html so they can include a <script src="…"></script> to it in the generated HTML. I believe their linker generates some sort of JSP code or similar, instead of the *.nocache.js that the other linkers output.
That way, they save one round-trip to the server, and given that the host page is already non-cacheable due to authentication, they don't lose anything (in a "default" setup, the host page is a static HTML page, so you can generally enable some level of caching on it; what matters being that the *.nocache.js is non-cacheable).
Reply all
Reply to author
Forward
0 new messages