4.4. Zend_Cache backends
Anterior | Capítulo 4. Zend_Cache | Próxima

## 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 :

Tabela 4.6. Available options

Option | Data Type | Default Value | Description
--- | --- | --- | ---
`cacheDir` | `string` | `'/tmp/'` | Directory where to store cache files
`fileLocking` | `boolean` | `true` | Enable / disable fileLocking : Can avoid cache corruption under bad circumstances but it doesn't help on multithread webservers or on NFS filesystems...
`readControl` | `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.
`readControlType` | `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).
`hashedDirectoryLevel` | `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.
`hashedDirectoryUmask` | `int` | `0700` | Umask for the hashed directory structure

### 4.4.2. Zend_Cache_Backend_Sqlite

This backends stores cache records into a SQLite database.

Available options are :

Tabela 4.7. Available options

Option | Data Type | Default Value | Description
--- | --- | --- | ---
`cacheDBCompletePath (mandatory)` | `string` | `null` | The complete path (filename included) of the SQLite database
`automaticVacuumFactor` | `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 :

Tabela 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` | `flase` | 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.

Anterior | Acima | Próxima
4.3. Zend_Cache frontends | Principal | Capítulo 5. Zend_Config