4.4. Zend_Cache backends

4.4.1. Zend_Cache_Backend_File

This backends stores cache records into files (in a choosen directory).

Available options are :

Table 4.6. Available options

Option Data Type Default Value Description
cache_dir string '/tmp/' Directory where to store cache files
file_locking boolean true Enable / disable file_locking : Can avoid cache corruption under bad circumstances but it doesn't help on multithread webservers or on NFS filesystems...
read_control boolean true Enable / disable read control : if enabled, a control key is embeded in the cache file and this key is compared with the one calculated after the reading.
read_control_type string 'crc32' Type of read control (only if read control is enabled). Available values are : 'md5' (best but slowest), 'crc32' (lightly less safe but faster, better choice), 'strlen' for a length only test (fastest).
hashed_directory_level int 0 Hashed directory structure level : 0 means "no hashed directory structure", 1 means "one level of directory", 2 means "two levels"... This option can speed up the cache only when you have many thousands of cache files. Only specific benchs can help you to choose the perfect value for you. Maybe, 1 or 2 is a good start.
hashed_directory_umask int 0700 Umask for the hashed directory structure
file_name_prefix string 'zend_cache' prefix for cache files ; be really carefull with this option because a too generic value in a system cache dir (like /tmp) can cause disasters when cleaning the cache

4.4.2. Zend_Cache_Backend_Sqlite

This backends stores cache records into a SQLite database.

Available options are :

Table 4.7. Available options

Option Data Type Default Value Description
cache_db_complete_path (mandatory) string null The complete path (filename included) of the SQLite database
automatic_vacuum_factor int 10 Disable / Tune the automatic vacuum process. The automatic vacuum process defragment the database file (and make it smaller) when a clean() or delete() is called : 0 means no automatic vacuum ; 1 means systematic vacuum (when delete() or clean() methods are called) ; x (integer) > 1 => automatic vacuum randomly 1 times on x clean() or delete().

4.4.3. Zend_Cache_Backend_Memcached

This backends stores cache records into a memcached server. memcached is a high-performance, distributed memory object caching system. To use this backend, you need a memcached daemon and the memcache PECL extension.

Be careful : with this backend, "tags" are not supported for the moment as the "doNotTestCacheValidity=true" argument.

Available options are :

Table 4.8. Available options

Option Data Type Default Value Description
servers array array(array('host' => 'localhost','port' => 11211, 'persistent' => true)) An array of memcached servers ; each memcached server is described by an associative array : 'host' => (string) : the name of the memcached server, 'port' => (int) : the port of the memcached server, 'persistent' => (bool) : use or not persistent connections to this memcached server
compression boolean false true if you want to use on-the-fly compression

4.4.4. Zend_Cache_Backend_APC

This backends stores cache records in shared memory through the APC (Alternative PHP Cache) extension (which is of course need for using this backend).

Be careful : with this backend, "tags" are not supported for the moment as the "doNotTestCacheValidity=true" argument.

There is no option for this backend.

4.4.5. Zend_Cache_Backend_ZendPlatform

This backend uses content caching API of the Zend Platform product. Naturally, to use this backend you need to have Zend Platform installed.

This backend supports tags, but does not support CLEANING_MODE_NOT_MATCHING_TAG cleaning mode.

There is no options for this backend.