Home

An individual cacheBust for each dojo build layer

version 2010-07-29 - by Guillaume Lathoud (glathoud _at_ yahoo _dot_ fr)

What is cacheBust:

Hockey, Ben wrote:

I should mention that dojo.require will use the cacheBust to form a url like
http://your.domain.com/your/my/app.js?123
where 123 is the value of djConfig.cacheBust

The browser caches app.js, until cacheBust changes (e.g. build timestamp).

Observation

New build => new cacheBust value 456 => the browser reloads all build layers.

What I am proposing:

The browser reloads only the build layers that changed.

How: during dojo.require("my.build.layer"), use the hash of my.build.layer as cacheBust value (e.g. MD5 sum).

This is heavily inspired from JAWR's hash URLs, but here we have:

Here is the implementation.

Notes

The focus is on the custom build layers ("my.build.layer"). HTML usage:

This is indeed dojo-specific. The cacheBust optimization is *fully* encapsulated in the javascript build, which has IMHO the following advantages:

Acknowledgments

I would like to thank Stephan Schlott, for pointing the JAWR framework to me ; the JAWR developers for their clear documentation ; Ben Hockey and XMaNIaC for their interesting comments ; and all the dojo developers for their great work.


Produced on 2010-07-29 by dojo_cachebust_hash.scmValid HTML 4.01 Strict