version 2010-07-29 - by Guillaume Lathoud (glathoud _at_ yahoo _dot_ fr)
Hockey, Ben wrote:
I should mention that dojo.require will use the cacheBust to form a url likewhere 123 is the value of djConfig.cacheBusthttp://your.domain.com/your/my/app.js?123
The browser caches app.js, until cacheBust changes (e.g. build timestamp).
New build => new cacheBust value 456 => the browser reloads all build layers.
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.
The focus is on the custom build layers ("my.build.layer"). HTML usage:
dojo.js through a <script> tag."my.build.layer") through dojo.require()'s, to take advantage of the proposed cacheBust optimization.This is indeed dojo-specific. The cacheBust optimization is *fully* encapsulated in the javascript build, which has IMHO the following advantages:
<script> tags, neither for layers nor for their layerDependencies.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.scm