{"data":{"markdownRemark":{"html":"<blockquote>\n<p><strong>tl;dr</strong> - A hash of the contents of a file is included in the filename. A change in the content changes the filename. These files can be cached forever. This is awesome.</p>\n</blockquote>\n<h2>What is a hash?</h2>\n<p>There's a lot of great content on this topic already. Google has some great answers to this question.</p>\n<p>Just for you. A very short summary. Hashing is a mathematical function. The hash function output is always the same size. A very small change in the input creates a large change in the output.</p>\n<p>Here's a few md5 examples:</p>\n<ul>\n<li>\n<p>Input <code class=\"language-text\">hello</code></p>\n<ul>\n<li>Output <code class=\"language-text\">5d41402abc4b2a76b9719d911017c592</code></li>\n</ul>\n</li>\n<li>\n<p>Input <code class=\"language-text\">hello.</code></p>\n<ul>\n<li>Output <code class=\"language-text\">d94c10e437d18531e122ed0b45badd2a</code></li>\n</ul>\n</li>\n</ul>\n<h2>Why do you care?</h2>\n<p>Gatsby generates lots of static files. Those files have names. One part of the name is a hash. The hash is built from the contents of the file. A small change in the content of the file changes the hash.</p>\n<p>Now every change creates a new filename. No matter how small the change. Each time the content changes, the file name changes. <em>Every version of a file has its own unique name</em>.</p>\n<p>Great. So what?</p>\n<p>So now your static files can be cached <strong>forever</strong>.</p>\n<h2>Caching</h2>\n<p>Gatsby is all about speed. Insanely fast static sites. One part of insanely fast is caching. Cache as much as possible.</p>\n<p>The content hashing technique helps with caching. The contents of a file will never change. If the content changes, the name changes, so it's a new file. Now the static files can be cached indefinitely.</p>\n<p>That's really helpful. Why? Updating a cache is hard. It's much easier to push stuff into a cache and forget about it. It never changes. Every change creates a new file. Add files. Never delete. Easy.</p>\n<h2>Static files</h2>\n<p>All of Gatsby's static files apply this technique. The <code class=\"language-text\">.html</code> pages do not. You need to be able to change the content of your site. So the <code class=\"language-text\">.html</code> pages must change over time. But otherwise, all other files can be cached forever.</p>","excerpt":"tl;dr  - A hash of the contents of a file is included in the filename. A change in the content changes the filename. These files can be…","timeToRead":2,"frontmatter":{"date":"April 10, 2018","path":"/what-is-cache-busting-or-content-hashing","title":"What is cache busting or content hashing?"}},"relatedPosts":null,"allCommentsJson":null,"allRatingsJson":{"totalCount":2,"edges":[{"node":{"id":"94a5b451-d947-5e12-984e-0ea8c8308fd5","rating":"5"}},{"node":{"id":"c3fae3e5-77c8-5dc1-8199-4e2fbdba21a9","rating":"5"}}]}},"pageContext":{"tags":[]}}