Page Cache

The Zend Page Cache improves PHP application performance by caching the entire output of PHP scripts (HTML, XML, etc.), while still maintaining dynamic capabilities through an elaborate rules system.

Page caching extends the concept of caching files and applies it to pages. Caching by page facilitates the ability to eliminate situations where the same file is used in multiple instances, such as when the same file is used to redirect to several pages.

As opposed to other caching alternatives (Zend Server Data Cache and Zend Framework Zend Cache), the Zend Server Cache does not require any code changes and can be easily applied to existing applications. Moreover, while other caching solutions still run some code on recurring executions, the cache does not run any code to display the cached content, which results in improved performance.

Cache behavior is defined using a flexible rule system (rules are configured on the Applications | Caching Rules page) that allows you to maintain the dynamic capabilities of your applications.

Best Practice

Pages should be cached when their content is stable and does not require frequent changes. You can cache any PHP generated output including, HTML, XML, and images (if the images are generated by PHP, such as graphs and charts).
Compression
should be used to cache content such as HTML, XML and plain text, but is not recommended for caching binary output.

Caching is not recommended for files that have constantly changing output, such as clocks, timers and database queries.
Compression should not be used for images, PDF files, .exe files, ZIP files or any other compressed binary formats.

Note:

Zend Page Cache only caches GET and HEAD HTTP requests. To comply with the HTTP RFC, POST requests are never cached.

All cached content is stored in a hashed directory structure on disk. The location is defined by the directive zend_pagecache.save_path.

Caching Alternatives

Web pages that contain sections that continuously change can also be cached. This partial page caching solution can be accomplished by applying the Data Cache API to the portions of code that do not change. Data caching is an intermediate solution to provide a partial performance boost that can sustain the accuracy of changing content.  

To find out more about this alternative, go to Zend Data Cache.

Note:

Zend Page Cache is disabled when running PHP in CLI mode.