Simon Willison’s Weblog

Subscribe
Atom feed for etags

5 items tagged “etags”

2024

Add ETag header for static responses. I’ve been procrastinating on adding better caching headers for static assets (JavaScript and CSS) served by Datasette for several years, because I’ve been wanting to implement the perfect solution that sets far-future cache headers on every asset and ensures the URLs change when they are updated.

Agustin Bacigalup just submitted the best kind of pull request: he observed that adding ETag support for static assets would side-step the complexity while adding much of the benefit, and implemented it along with tests.

It’s a substantial performance improvement for any Datasette instance with a number of JavaScript plugins... like the ones we are building on Datasette Cloud. I’m just annoyed we didn’t ship something like this sooner!

# 17th March 2024, 7:25 pm / etags, web-performance, datasette, datasette-cloud

2008

ETags And Modification Times In Django. Part of Malcolm’s series of tutorials on implementing advanced HTTP concepts in Django.

# 13th December 2008, 9:49 am / caching, django, etags, http, malcolmtredinnick

2007

ETags, ETags, ETags. They’re no magic bullet.

# 7th August 2007, 2:51 pm / etags, http, mark-nottingham

Clever Caching. Instead of invalidating your cache directly, bump a version number on your model (blog entry or whatever) and use that as part of the cache key. This also gives you dynamic etags for free.

# 5th July 2007, 12:56 am / caching, etags, memcache, michael-koziarski

2003

Supporting Conditional GET in PHP

This site’s RSS feeds now support Conditional GET. Since the feeds are dynamically generated on every request, adding support took a bit of hacking around with PHP. Here’s the function I came up with (based on the excellent description provided by Charles Miller in the article linked above):

[... 398 words]