This week we will cover the Zend Cache, A script caching mechanism from Zend which will save pre-compiled versions of PHP scripts in order to avoid having to re-compile them every time, resulting in huge performance benefits. First we will go over the strengths and weaknesses of Zend's Cache and then we will move onto comparing the Zend Cache to other, open-source, free cache's.
Note: This is an educated guess at how the Cache works based on the way the two open source cache's work and some of Zend's online documentation.
To understand how the Zend cache works, it is first important to understand how theZend engine (the scripting engine that powers PHP 4) works. What the Zend engine does (in a very basic sense), is given a PHP file, parses it, and builds a complexdata structure based on the php file given to it (known as an op structure). Then it goes through this op structure, and executes it, performing the various calls (such as database connections, etc.) and functions defined by the op structure.
What the Zend Cache does is eliminates the need for the Zend engine to constantly re-compile (parse the php file into an op structure) a php file, by storing thecompiled results either in shared memory or in mmap'd files (beyond the scope of thisarticle, for more information "man mmap"). As file size and script complexity increases, this leads to significant speed increases.
In addition to cache'ing the compiled version of the script, the Zend Cache performs certain execution optimizations on the code (not present in its competitors), cutting down on the execution time of the program as well. This added bonus is a really nice feature, and probably a major contributor to the blazing speed the cache provides (note that this feature alone is availablewith the Zend Optimizer, a free product from Zend).
The Zend Cache also includes an online interface which allows you to set configuration optionssuch as how much memory the cache uses or whether or not to validate the timestampsof the files being cached. This online interface also provides a plethora of other information which can help you cut the speed of your applications. Some of these include cache activity, a list of most requested scripts, most memory intensive scripts, etc. You can view an online demo, at http://www.zend.com/cguidemo/.