yourhead / s3

public info about s3
8 stars 7 forks source link

Cache busting parameters to images #804

Closed joeworkman closed 6 years ago

joeworkman commented 6 years ago

RapidWeaver has the ability to add query string parameters to the end of JS and CSS files that the get added to the page. The unique ID on the parameter changes when you republish the site. This way, cached files can then be re-cached by the browser or Cloudflare.

What if this same thing was added to images as well? One tricky bit would be that if the same image was used across several pages, it would be nice if the query string was the same on both.

yourhead commented 6 years ago

would that be used much?
i mean, the reason we do that with CSS and JS files is that those files CHANGE -- they're mutable.

but images are (mostly) immutable.

there are definitely some corner cases where images do change content:

but both of those are relatively rare.

usually we want to optimize for the 80% case. but that would be optimizing for the 0.05% case.

if there are other use-cases for this that make it interesting maybe we can think of a way to solve the problem for just that case -- instead of burdening all images with that added extra complexity.

yourhead commented 6 years ago

yeah... i've thought about this some more. this is a really rare corner case.

there are a few other corner cases, but they start getting really exotic and rare. i think those cases are just too few to merit adding special cache-busting URLs.

but i'm all ears. if there is some special case i haven't thought of that's important and causing confusion -- by all means let me know. i think from there we would just take it case-by-case to determine what the best way to improve that use-case is.