The biggest thing you need to sort out when caching is exactly how well synced your cache needs to be.<p>Once you've written fresh data to the database, is it okay for you to keep receiving stale data in response to later queries?<p>If you've got multiple web servers, do they all have to return the same data, or is it okay if some lag behind the others?<p>If you're happy to serve stale (versus some tunable time metric) data inconsistently across different servers, then just find a database client library that does client-side result set caching (ADODB for PHP will do this, either in the filesystem or against memcache) and run with it.