Nail me to the Past: Publishing and Updating your Tweet Archive

I have recently published my tweet archive here on this site (drmirror.net/tweets) and it has turned out to be one of the most useful online tools I’ve discovered in quite a while. Because I usually tweet about everything I find interesting, the archive is an excellent means (and sometimes the only means) to re-discover something I’ve come across in the past.

I have also promised I would update my tweet archive regularly (you can download a fresh one from Twitter once a week). When I tried this today for the first time, I realized the caching of Javascript pages can get in the way. Since the archive is implemented entirely in Javascript, browsers will not by themselves pick up the new version of the archive, not even if you restart the browser or hold shift while clicking the reload button. (Users would have to actually clear their entire browser cache to pick up the new archive version.)

The most elegant solution to this problem seems to be Google’s mod_pagespeed Apache module. It sits as an output filter in your web server and performs all sorts of optimizations on the content that it serves, including auto-versioning of Javascript modules. This way, you can simply upload and unpack a new version of your tweet archive on the server, and mod_pagespeed will magically make sure that updated Javascript modules will be renamed to force reloading of them by the client. It actually seems to work completely by itself, without any configuration of mod_pagespeed required. (At one point, when I tried going back and forth between versions of my tweet archive, it seemed the served content got out of sync, but I could fix that by clearing the mod_pagespeed cache under /var/cache/mod_pagespeed.)

Leave a Reply