title: Reliable file caching
body: <p>I'm trying to determine the best way to cache my JavaScript and CSS files.</p>
  
  <p>There are several ways of doing this:</p>
  
  <ol>
  <li>Using the <code>Date</code>, <code>Expires</code> and <code>Cache-Control</code> headers</li>
  <li>Using the <code>ETag</code> header</li>
  <li>Cache forever and change the filename when the file changes</li>
  <li>Append a querystring to the filename in the HTML with the last mod time or an MD5 of the file contents</li>
  </ol>
  
  <p>I was under the impression that the last method (4) was the most reliable and would result in the fewest unnecessary requests, but my friend just told me that sometimes the querystring method is unreliable and you actually need to change the filename.</p>
  
  <p>Are there any downsides to setting the HTTP headers to cache forever and just using a query-string with the last mod time, or are there scenarios where another method would be more beneficial?</p>