:title: Caching
:description: How does the TinySite Caching work? Caching headers for Heroku’s Varnish.
++++body++++
TinySite adds HTTP caching headers to support Heroku’s Varnish cache. In addition to that, fetched textile files are cached in-app for up to one hour.
You can bust the cache by adding a configurable cache-busting query string. By default it’s bust
. To avoid caching, you just add it to the URL like this: http://foo/bar?bust
. In addition to clearing the internal cache this adds a cache-control header to prevent caching in any HTTP cache between you and the app.
You use the cache buster to make changes to the page immediately visible for you to review them (and still others will most likely get the old version for quite some time). I couldn’t figure out a possibility to expire Heroku’s Varnish cache on demand, so at the moment you have no control over when exactly changes are visible. It could take up to two hours (one for the internal content file cache and one for the external HTTP cache). As stated, you can clear the internal cache of all pages by adding the cache buster query string and cut the time to max one hour.
It’s a good idea to choose a relatively secret cache buster query string, e.g. a4f36b22e, so other people can’t fiddle with your apps cache.