Doing HTTP caching in PHP
Since the Mobile Web Best Practices highlights that caching is a particularly important feature when browing the Web on a mobile device, I just wrote a new associated technique on how to do proper caching when using PHP.
While Mark Nottingham’s excellent tutorial on the topic covers most of it already, the technique provides some additional code example, as well as some illustration as how to use it with MySQL.
Nothing ground breaking, but I’ve been using this code in most of my PHP applications over the past years, and it certainly gives a nice and warm feeling of being a good HTTP citizen when you pass the Cacheability validation.
(As we’re trying our best to keep the Mobile Web Initiative home page in conformance with the best practices, this code has just found a new usage in a mobile context…)
July 28th, 2006 at 16:20
This is a nice initiative.
It is indeed quite rare that PHP scripts take advantage of the full potential of HTTP/1.1.
A while ago, I have written an Open Source library dedicated to this purpose, handling all types of HTTP/1.1 conditional requests, HEAD requests, caching, compression, and a RSS/ATOM special mode:
http://alexandre.alapetite.net/doc-alex/php-http-304/