PhpRiot
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

Zend Framework 101: Zend_Cache

This article is part of the series “Zend Framework 101”. The Zend Framework 101 series covers many components that make up the Zend Framework in easy to understand articles.. Read more about Zend Framework 101...

Introduction

In this article I will introduce you to the Zend_Cache component of the Zend Framework. This component is used for improving the performance of your web application by saving generated data for later reuse.

Caching is typically used when the cost of generating the data is high, and the data doesn't change often enough to justify generating it from scratch upon every request.

While the idea behind caching is straightforward, there are certain considerations and complexities to be aware of. You need to consider the type of data you want to cache and the situations in which to use it.

In this article we will look at caching the following types of data:

  • Arbitrary data structures (such as data returned from a remote web feed or web service)
  • The entire output of a HTML page

Additionally, we will look at managing your cached data using tags. Tags allow you to clear relevant records without having to clear your entire cache.

Note: A typical application that makes use of caching will likely have more than one cache. Don't necessarily restrict your thinking to using only a single cache.

This article requires Zend Framework, downloadable from http://framework.zend.com. At time of writing, the current version of Zend Framework is 1.10.4.

In This Article