Zend_Cache interacts with a variety of common caching backends, including APC and Memcached, to make caching both flexible and painless.
But when should you use caching? The fact is that almost every website would benefit from increased caching. Let's say an affiliate marketing website generates a set of summary statistical information for its affiliate partners, and the information is presented on each page of the website. The system administration notices that the database load has spiked to unacceptable levels since the developers implemented the summary display on the website. Though the method that calculates the data is only called once per request, it produces too much load on the server, and it is decided that the affiliate partners would be happy if the data were only updated every five minutes. But how do the developers go about doing that?
Here we use the file caching mechanism to store the statistics in the file system cache for a lifetime of 5 minutes:
It's worth taking the time to explore the documentation and carefully pick the front-end and back-end that best suit your needs. If you do choose to use the file back-end, give it its own directory to work in, and consider the hashed_directory_level option. You may notice significant speed increases in a situation where there are many files present.
ZF Home Page
Code Browser
Wiki Dashboard