Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Speeding Up Your PHP Web Site

Caching Generated Pages

One of the biggest improvements you can make to your web site is to cache generated pages on the server. Every time a user fetches a page and a cached page is returned, many database queries need not be executed and overall performance will significantly improve.

Even if your content updates frequently, you could cache a page for a small amount of time (such as 5 to 10 minutes) and still reap significant rewards. Just be aware that different users may expect different content and cater accordingly (for instance, the web site navigation may be different for a logged-in user).

An effective way to implement caching in PHP is to use Zend_Cache. This component allows you to cache data at several different levels:

  • Entire HTML pages
  • Results from function / method calls
  • Arbitrary data (such as a remote feed)

For more details on implementing a caching solution, refer to the PhpRiot article Zend Framework 101: Zend_Cache.

In This Article