Simon Willison’s Weblog

Subscribe

Monday, 5th May 2003

Better structural markup rants

Better structural markup rants than mine: Owen Briggs’ classic Design Rant and Craig Saila’s Tables or CSS? Choosing a Layout. Incidentally, my rant has sparked some excellent feedback in the comments section.

Instant caching with PHP

I’ve been getting more database timeout errors today, probably due to increased traffic from links to recent entries. A permanent solution would be to switch to generating static HTML (this site is currently dynamically generated for every request), but I don’t have time for a full re-write at the moment. Luckily, PHP offers an extremely simple solution to dynamic caching in the form of output buffering. The front page of the site (which generates by far the most traffic) is now served from a cached copy if it has been cached within the last 5 minutes. Best of all, I didn’t have to edit any of my core application logic—I just dropped in some extra code at the top and bottom of the index.php file. Here’s how it works:

[... 271 words]

2003 » May

MTWTFSS
   1234
567891011
12131415161718
19202122232425
262728293031