Monday, June 14, 2010

PHP Fragment Cache - an introduction

I love this quote from the following article (see at the bottom part)

"Treat every optimization task as if John Miles has just written to inform you that he’s made it faster than your wildest dreams, and you’ll be amazed at what you can do!"


So if web caching is not an option, what is the next best thing? To cache parts of the page, put them together, and serve that. You can use a caching tool for this, like Memcached. There's only one catch: the cached content may need to change when any of the things it depends on changes: data, code, user input, and the like. You can pass an expiration time when you add your content to Memcache. This will cause your cache to live only a certain amount of time and then expire. Nice, but we can do better.


This article will introduce you to that powerful new form of website speed optimization called Fragment Caching. It builds upon ideas used elsewhere to make the technique even more powerful. A PHP implementation is available for download.

No comments: