Comparison
Cache bustingvsContent hash
Cache busting
you deployed a fix and users kept getting the old file until you changed its name.
Forcing a fetch of a changed asset by changing the URL it lives at, rather than trying to persuade caches to expire. Query strings were the old approach and are unreliable in intermediate caches; a content hash in the filename is the current one. Anything served without a hash — the HTML entry point, a service worker script — needs a short cache lifetime instead, because that is the only lever left.
Full entry →Content hash
the file is named with a string of hex that changes only when its contents change.
A hash of a file's contents embedded in its filename, so a given URL always maps to exactly one version of the file. It is what makes it safe to cache an asset forever, because a new version is a new URL rather than the same URL with new bytes. It only works if the HTML referring to it is not cached the same way, which is the mistake that pins users to an old build.
Full entry →