Skip to content
jhpedemonte edited this page Jul 22, 2011 · 6 revisions

Caching Issues

List of files for which we need to define proper cache busting and expires headers.

  • Top level files, user's entry point into app (i.e. pagedesigner.html, review.html)

    • expires header: 24 hours
  • App files (JS, HTML, CSS)

    The build process should place each set of files in a versioned directory. When updated, version changes in URL, forcing browser to bypass cache and load files from server.

    • Maqetta files
      • URL: http://host/maqetta/app/davinci/<revision>/davinci.js

        where revision is the first 7 characters of the Git hash from which the build was produced.

    • Dojo library
      • URL: http://host/maqetta/app/dojo/<version>/dojo.js

      • URL: http://host/maqetta/app/dijit/<version>/dijit.js

        where version is the version number of the Dojo lib (i.e. 1.6, 1.7b2, 1.7.0.1, ...). Don't use Git hash here, since it's possible that a new Maqetta version will keep the same Dojo version. By using the Dojo version, we avoid having users request the Dojo files again, when they haven't changed.

    • expires header: 1 year
  • User workspace files, in particular lib & theme

    User can change URL for lib files, so cannot depend on version string as part of URL path. Instead, we must rely on URL parameters.

    • read-only files (libs and themes)
      • URL: http://host/maqetta/user/<userId>/ws/workspace/lib/dojo/dojo/resources/blank.gif?v=<libVersion>

      • URL: http://host/maqetta/user/<userId>/ws/workspace/themes/claro/form/images/button.png?v=<themeVersion>

        where libVersion and themeVersion are the version string for that particular library/theme. As in the App files section, this cuts down on unnecessary server requests.

    • editable files (user's files and custom themes)
      • URL: http://host/maqetta/user/<userId>/ws/workspace/themes/myclaro/myclaro.css?v=<revision>

        where revision is a generated number. Every time user updates custom theme, number gets regenerated (increment or random). This way, user is sure to get latest files (cache busted by newly generated number); but if no changes, then files are pulled from cache.

    • expires header: 1 year
  • Preview

    • cache headers: no caching

      Preview should reflect the very latest state of the file, therefore we must set headers to disable caching preview files.

  • REST APIs

    • URL: http://host/maqetta/cmd/loadFile?path=.%2Fapp.css

    Do we need to do anything with these? Since we always want non-stale data, could be just as simple as appending a URL param with latest time in milliseconds. Or, if using Dojo's XHR methods, set the preventCache argument (which also just sets a URL param).

Clone this wiki locally