Art Menagerie supports cache busting by adding a query like ?v=9PtfcQ to link URLs.
Important! This is NOT used for tracking. Art Menagerie does not and will not intentionally track you!
(You are absolutely correct to be suspicious of odd looking things in your URL though!)
What is Cache Busting?
Cache busting is a method making unique URLs when you make a change to your website to ensure the browser sees the latest version when you make a change.
Let's break this down.
Web browsers are optimized to cache websites that you visit. If you visit a website and you have been to before, the browser often looks in its cache to see if it already has it. If your browser has it cached, it uses the cache rather than fetching it again, which significantly improves performance. Cache is a good thing!
However, let's say you change your site logo which is located at /-/logo.jpg. Your browser may show you the old logo because it sees /-/logo.jpg and uses the cached version rather than the updated version. Cache usually has a lifetime and the browser may hold onto cache for hours, days, or months.
How do we use cache, but tell the browser there is a new version of the logo?
This is where cache busting comes into play. We can add a query like ?v=WetYNg to our URL so our logo's new URL becomes /-/logo.jpg?v=WetYNg which our browser sees as new and fetches it from the server.
You can actually put just about any valid query in the URL, like ?mycachebust, and the browser will see this as a unique URL to fetch. The web server still sees /-/logo.jpg?v=WetYNg as the same file and will send the logo at /-/logo.jpg.
How is Cache Busting Generated?
If our example logo URL is /-/logo.jpg?v=WetYNg, how do we generate WetYNg for cache busting?
We use the the checksum (CRC32) hash algorithm and encode the result as URL-safe Base64.
The hash combines:
- version of Art Menagerie
- modify time of the item (post, logo, feed, etc.)
So the hash will be unique if either of these are changed.
We use a 32-bit hash to scramble the details and make them less obvious and to take what could be a long string down to just six characters!
In total, adding cache busting only adds eight characters to each URL.