Is it the filename or the whole URL used as a key in browser caches?
- by Richard Turner
It's common to want browsers to cache resources - JavaScript, CSS, images, etc. until there is a new version available, and then ensure that the browser fetches and caches the new version instead.
One solution is to embed a version number in the resource's filename, but will placing the resources to be managed in this way in a directory with a revision number in it do the same thing? Is the whole URL to the file used as a key in the browser's cache, or is it just the filename itself and some meta-data?
If my code changes from fetching '/r20/example.js' to '/r21/example.js', can I be sure that revision 20 of example.js was cached, but now revision 21 has been fetched instead and it is now cached?