Chapter 14. Caching: making it faster
This chapter covers
- How caching works
- Introducing the Zend_Cache component
- Using Zend_Cache frontend classes
- Choosing what to cache and for how long
Caching refers to taking a computationally expensive task, such as a database query or intense mathematical calculation, and storing the result so that next time the result can be quickly retrieved from the cache instead of repeating the task. This chapter will explain the benefits of caching, show you how to take advantage of these benefits using Zend Framework’s Zend_Cache, and guide you through the process for choosing appropriate cache settings for your application.
On one project, Steven’s client was told that the shared hosting account they were using was consuming too many resources and that, if the issue wasn’t resolved, the account would be suspended. The site served over 40,000 members, many of whom visited the site on a daily basis. Having the account suspended would have been a disaster. The site was also slowing to a crawl, and database and memory errors had started to appear.