<p>What is the best way of implementing a cache for a PHP site? Obviously, there are some things that shouldn't be cached (for example search queries), but I want to find a good solution that will make sure that I avoid the 'digg effect'.</p>

<p>I know there is WP-Cache for WordPress, but I'm writing a custom solution that isn't built on WP. I'm interested in either writing my own cache (if it's simple enough), or you could point me to a nice, light framework. I don't know much Apache though, so if it was a PHP framework then it would be a better fit.</p>

<p>Thanks.</p>

The best way to go is to use a proxy cache (Squid, Varnish) and serve appropriate Cache-Control/Expires headers, along with ETags : see
Mark Nottingham's Caching Tutorial
for a full description of how caches work and how you can get the most performance out of a caching proxy.
Also check out
memcached
, and try to cache your database queries (or better yet, pre-rendered page fragments) in there.