Zend_Cache-Backends.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.cache.backends">
  4. <title>Zend_Cache Backends</title>
  5. <para>
  6. There are two kinds of backends: standard ones and extended ones. Of course, extended backends
  7. offer more features.
  8. </para>
  9. <sect2 id="zend.cache.backends.file">
  10. <title>Zend_Cache_Backend_File</title>
  11. <para>
  12. This (extended) backends stores cache records into files (in a choosen directory).
  13. </para>
  14. <para>
  15. Available options are :
  16. </para>
  17. <table id="zend.cache.backends.file.table">
  18. <title>File Backend Options</title>
  19. <tgroup cols="4">
  20. <thead>
  21. <row>
  22. <entry>Option</entry>
  23. <entry>Data Type</entry>
  24. <entry>Default Value</entry>
  25. <entry>Description</entry>
  26. </row>
  27. </thead>
  28. <tbody>
  29. <row>
  30. <entry><code>cache_dir</code></entry>
  31. <entry><code>string</code></entry>
  32. <entry><code>'/tmp/'</code></entry>
  33. <entry>
  34. Directory where to store cache files
  35. </entry>
  36. </row>
  37. <row>
  38. <entry><code>file_locking</code></entry>
  39. <entry><code>boolean</code></entry>
  40. <entry><code>true</code></entry>
  41. <entry>
  42. Enable / disable file_locking : Can avoid cache corruption under
  43. bad circumstances but it doesn't help on multithread webservers
  44. or on NFS filesystems...
  45. </entry>
  46. </row>
  47. <row>
  48. <entry><code>read_control</code></entry>
  49. <entry><code>boolean</code></entry>
  50. <entry><code>true</code></entry>
  51. <entry>
  52. Enable / disable read control : if enabled, a control key is
  53. embedded in the cache file and this key is compared with the
  54. one calculated after the reading.
  55. </entry>
  56. </row>
  57. <row>
  58. <entry><code>read_control_type</code></entry>
  59. <entry><code>string</code></entry>
  60. <entry><code>'crc32'</code></entry>
  61. <entry>
  62. Type of read control (only if read control is enabled). Available values are :
  63. 'md5' (best but slowest), 'crc32' (lightly less safe but faster, better choice),
  64. 'adler32' (new choice, faster than crc32),
  65. 'strlen' for a length only test (fastest).
  66. </entry>
  67. </row>
  68. <row>
  69. <entry><code>hashed_directory_level</code></entry>
  70. <entry><code>int</code></entry>
  71. <entry><code>0</code></entry>
  72. <entry>
  73. Hashed directory structure level : 0 means "no hashed directory
  74. structure", 1 means "one level of directory", 2 means "two levels"...
  75. This option can speed up the cache only when you have many thousands of
  76. cache files. Only specific benchs can help you to choose the perfect
  77. value for you. Maybe, 1 or 2 is a good start.
  78. </entry>
  79. </row>
  80. <row>
  81. <entry><code>hashed_directory_umask</code></entry>
  82. <entry><code>int</code></entry>
  83. <entry><code>0700</code></entry>
  84. <entry>
  85. Umask for the hashed directory structure
  86. </entry>
  87. </row>
  88. <row>
  89. <entry><code>file_name_prefix</code></entry>
  90. <entry><code>string</code></entry>
  91. <entry><code>'zend_cache'</code></entry>
  92. <entry>
  93. prefix for cache files ; be really careful with this option because
  94. a too generic value in a system cache dir (like /tmp) can cause
  95. disasters when cleaning the cache
  96. </entry>
  97. </row>
  98. <row>
  99. <entry><code>cache_file_umask</code></entry>
  100. <entry><code>int</code></entry>
  101. <entry><code>0700</code></entry>
  102. <entry>
  103. umask for cache files
  104. </entry>
  105. </row>
  106. <row>
  107. <entry><code>metatadatas_array_max_size</code></entry>
  108. <entry><code>int</code></entry>
  109. <entry><code>100</code></entry>
  110. <entry>
  111. internal max size for the metadatas array (don't change this value unless you
  112. know what you are doing)
  113. </entry>
  114. </row>
  115. </tbody>
  116. </tgroup>
  117. </table>
  118. </sect2>
  119. <sect2 id="zend.cache.backends.sqlite">
  120. <title>Zend_Cache_Backend_Sqlite</title>
  121. <para>
  122. This (extended) backends stores cache records into a SQLite database.
  123. </para>
  124. <para>
  125. Available options are :
  126. </para>
  127. <table id="zend.cache.backends.sqlite.table">
  128. <title>Sqlite Backend Options</title>
  129. <tgroup cols="4">
  130. <thead>
  131. <row>
  132. <entry>Option</entry>
  133. <entry>Data Type</entry>
  134. <entry>Default Value</entry>
  135. <entry>Description</entry>
  136. </row>
  137. </thead>
  138. <tbody>
  139. <row>
  140. <entry><code>cache_db_complete_path (mandatory)</code></entry>
  141. <entry><code>string</code></entry>
  142. <entry><code>null</code></entry>
  143. <entry>
  144. The complete path (filename included) of the SQLite database
  145. </entry>
  146. </row>
  147. <row>
  148. <entry><code>automatic_vacuum_factor</code></entry>
  149. <entry><code>int</code></entry>
  150. <entry><code>10</code></entry>
  151. <entry>
  152. Disable / Tune the automatic vacuum process.
  153. The automatic vacuum process defragment the database file (and make it smaller)
  154. when a clean() or delete() is called :
  155. 0 means no automatic vacuum ;
  156. 1 means systematic vacuum (when delete() or clean() methods are called) ;
  157. x (integer) > 1 => automatic vacuum randomly 1 times on x clean() or delete().
  158. </entry>
  159. </row>
  160. </tbody>
  161. </tgroup>
  162. </table>
  163. </sect2>
  164. <sect2 id="zend.cache.backends.memcached">
  165. <title>Zend_Cache_Backend_Memcached</title>
  166. <para>
  167. This (extended) backends stores cache records into a memcached server. <ulink url="http://www.danga.com/memcached/">memcached</ulink>
  168. is a high-performance, distributed memory object caching system. To use this backend,
  169. you need a memcached daemon and <ulink url="http://pecl.php.net/package/memcache">the memcache PECL extension</ulink>.
  170. </para>
  171. <para>
  172. Be careful : with this backend, "tags" are not supported for the moment as
  173. the "doNotTestCacheValidity=true" argument.
  174. </para>
  175. <para>
  176. Available options are :
  177. </para>
  178. <table id="zend.cache.backends.memcached.table">
  179. <title>Memcached Backend Options</title>
  180. <tgroup cols="4">
  181. <thead>
  182. <row>
  183. <entry>Option</entry>
  184. <entry>Data Type</entry>
  185. <entry>Default Value</entry>
  186. <entry>Description</entry>
  187. </row>
  188. </thead>
  189. <tbody>
  190. <row>
  191. <entry><code>servers</code></entry>
  192. <entry><code>array</code></entry>
  193. <entry>
  194. <code>
  195. array(array('host' => 'localhost', 'port' => 11211, 'persistent' => true, 'weight' => 1,
  196. 'timeout' => 5, 'retry_interval' => 15, 'status' => true, 'failure_callback' => '' ))
  197. </code>
  198. </entry>
  199. <entry>
  200. An array of memcached servers ; each memcached server is described by an associative array :
  201. 'host' => (string) : the name of the memcached server,
  202. 'port' => (int) : the port of the memcached server,
  203. 'persistent' => (bool) : use or not persistent connections to this memcached server
  204. 'weight' => (int) :the weight of the memcached server,
  205. 'timeout' => (int) :the time out of the memcached server,
  206. 'retry_interval' => (int) :the retry interval of the memcached server,
  207. 'status' => (bool) :the status of the memcached server,
  208. 'failure_callback' => (callback) : the failure_callback of the memcached server
  209. </entry>
  210. </row>
  211. <row>
  212. <entry><code>compression</code></entry>
  213. <entry><code>boolean</code></entry>
  214. <entry><code>false</code></entry>
  215. <entry>
  216. true if you want to use on-the-fly compression
  217. </entry>
  218. </row>
  219. <row>
  220. <entry><code>compatibility</code></entry>
  221. <entry><code>boolean</code></entry>
  222. <entry><code>false</code></entry>
  223. <entry>
  224. true if you want to use this compatibility mode with old memcache servers/extensions
  225. </entry>
  226. </row>
  227. </tbody>
  228. </tgroup>
  229. </table>
  230. </sect2>
  231. <sect2 id="zend.cache.backends.apc">
  232. <title>Zend_Cache_Backend_Apc</title>
  233. <para>
  234. This (extended) backends stores cache records in shared memory through
  235. the <ulink url="http://pecl.php.net/package/APC">APC</ulink> (Alternative PHP Cache) extension
  236. (which is of course need for using this backend).
  237. </para>
  238. <para>
  239. Be careful : with this backend, "tags" are not supported for the moment as
  240. the "doNotTestCacheValidity=true" argument.
  241. </para>
  242. <para>
  243. There is no option for this backend.
  244. </para>
  245. </sect2>
  246. <sect2 id="zend.cache.backends.xcache">
  247. <title>Zend_Cache_Backend_Xcache</title>
  248. <para>
  249. This backends stores cache records in shared memory through
  250. the <ulink url="http://xcache.lighttpd.net/">XCache</ulink> extension
  251. (which is of course need for using this backend).
  252. </para>
  253. <para>
  254. Be careful : with this backend, "tags" are not supported for the moment as
  255. the "doNotTestCacheValidity=true" argument.
  256. </para>
  257. <para>
  258. Available options are :
  259. </para>
  260. <table id="zend.cache.backends.xcache.table">
  261. <title>Xcache Backend Options</title>
  262. <tgroup cols="4">
  263. <thead>
  264. <row>
  265. <entry>Option</entry>
  266. <entry>Data Type</entry>
  267. <entry>Default Value</entry>
  268. <entry>Description</entry>
  269. </row>
  270. </thead>
  271. <tbody>
  272. <row>
  273. <entry><code>user</code></entry>
  274. <entry><code>string</code></entry>
  275. <entry><code>null</code></entry>
  276. <entry>
  277. xcache.admin.user, necessary for the clean() method
  278. </entry>
  279. </row>
  280. <row>
  281. <entry><code>password</code></entry>
  282. <entry><code>string</code></entry>
  283. <entry><code>null</code></entry>
  284. <entry>
  285. xcache.admin.pass (in clear form, not MD5), necessary for the clean() method
  286. </entry>
  287. </row>
  288. </tbody>
  289. </tgroup>
  290. </table>
  291. </sect2>
  292. <sect2 id="zend.cache.backends.platform">
  293. <title>Zend_Cache_Backend_ZendPlatform</title>
  294. <para>
  295. This backend uses content caching API of the <ulink url="http://www.zend.com/products/platform">Zend Platform</ulink> product. Naturally, to use this backend you need to have Zend Platform installed.
  296. </para>
  297. <para>
  298. This backend supports tags, but does not support <code>CLEANING_MODE_NOT_MATCHING_TAG</code> cleaning mode.
  299. </para>
  300. <para>
  301. Specify this backend using a word separator -- '-', '.', ' ', or '_'
  302. -- between the words 'Zend' and 'Platform' when using the
  303. <classname>Zend_Cache::factory()</classname> method:
  304. </para>
  305. <programlisting role="php"><![CDATA[
  306. $cache = Zend_Cache::factory('Core', 'Zend Platform');
  307. ]]></programlisting>
  308. <para>
  309. There are no options for this backend.
  310. </para>
  311. </sect2>
  312. <sect2 id="zend.cache.backends.twolevels">
  313. <title>Zend_Cache_Backend_TwoLevels</title>
  314. <para>
  315. This (extend) backend is an hybrid one. It stores cache records in two other backends : a fast
  316. one (but limited) like Apc, Memcache... and a "slow" one like File, Sqlite...
  317. </para>
  318. <para>
  319. This backend will use the priority parameter (given at the frontend level when storing a record)
  320. and the remaining space in the fast backend to optimize the usage of these two backends.
  321. FIXME
  322. </para>
  323. <para>
  324. Available options are :
  325. </para>
  326. <table id="zend.cache.backends.twolevels.table">
  327. <title>TwoLevels Backend Options</title>
  328. <tgroup cols="4">
  329. <thead>
  330. <row>
  331. <entry>Option</entry>
  332. <entry>Data Type</entry>
  333. <entry>Default Value</entry>
  334. <entry>Description</entry>
  335. </row>
  336. </thead>
  337. <tbody>
  338. <row>
  339. <entry><code>slow_backend</code></entry>
  340. <entry><code>string</code></entry>
  341. <entry><code>File</code></entry>
  342. <entry>
  343. the "slow" backend name
  344. </entry>
  345. </row>
  346. <row>
  347. <entry><code>fast_backend</code></entry>
  348. <entry><code>string</code></entry>
  349. <entry><code>Apc</code></entry>
  350. <entry>
  351. the "fast" backend name
  352. </entry>
  353. </row>
  354. <row>
  355. <entry><code>slow_backend_options</code></entry>
  356. <entry><code>array</code></entry>
  357. <entry><code>array()</code></entry>
  358. <entry>
  359. the "slow" backend options
  360. </entry>
  361. </row>
  362. <row>
  363. <entry><code>fast_backend_options</code></entry>
  364. <entry><code>array</code></entry>
  365. <entry><code>array()</code></entry>
  366. <entry>
  367. the "fast" backend options
  368. </entry>
  369. </row>
  370. <row>
  371. <entry><code>slow_backend_custom_naming</code></entry>
  372. <entry><code>boolean</code></entry>
  373. <entry><code>false</code></entry>
  374. <entry>
  375. if true, the slow_backend argument is used as a complete class name ; if false,
  376. the frontend argument is used as the end of "Zend_Cache_Backend_[...]"
  377. class name
  378. </entry>
  379. </row>
  380. <row>
  381. <entry><code>fast_backend_custom_naming</code></entry>
  382. <entry><code>boolean</code></entry>
  383. <entry><code>false</code></entry>
  384. <entry>
  385. if true, the fast_backend argument is used as a complete class name ; if false,
  386. the frontend argument is used as the end of "Zend_Cache_Backend_[...]"
  387. class name
  388. </entry>
  389. </row>
  390. <row>
  391. <entry><code>slow_backend_autoload</code></entry>
  392. <entry><code>boolean</code></entry>
  393. <entry><code>false</code></entry>
  394. <entry>
  395. if true, there will no require_once for the slow backend
  396. (useful only for custom backends)
  397. </entry>
  398. </row>
  399. <row>
  400. <entry><code>fast_backend_autoload</code></entry>
  401. <entry><code>boolean</code></entry>
  402. <entry><code>false</code></entry>
  403. <entry>
  404. if true, there will no require_once for the fast backend
  405. (useful only for custom backends)
  406. </entry>
  407. </row>
  408. <row>
  409. <entry><code>auto_refresh_fast_cache</code></entry>
  410. <entry><code>boolean</code></entry>
  411. <entry><code>true</code></entry>
  412. <entry>
  413. if true, auto refresh the fast cache when a cache record is hit
  414. </entry>
  415. </row>
  416. <row>
  417. <entry><code>stats_update_factor</code></entry>
  418. <entry><code>integer</code></entry>
  419. <entry><code>10</code></entry>
  420. <entry>
  421. disable / tune the computation of the fast backend filling percentage
  422. (when saving a record into cache, computation of the fast backend filling percentage
  423. randomly 1 times on x cache writes)
  424. </entry>
  425. </row>
  426. </tbody>
  427. </tgroup>
  428. </table>
  429. </sect2>
  430. <sect2 id="zend.cache.backends.zendserver">
  431. <title>Zend_Cache_Backend_ZendServer_Disk and Zend_Cache_Backend_ZendServer_ShMem</title>
  432. <para>
  433. These backends store cache records using
  434. <ulink url="http://www.zend.com/en/products/server/downloads-all?zfs=zf_download">Zend Server</ulink> caching functionality.
  435. </para>
  436. <para>
  437. Be careful: with these backends, "tags" are not supported for the moment as the "doNotTestCacheValidity=true" argument.
  438. </para>
  439. <para>
  440. These backend work only withing Zend Server environment for pages requested through HTTP(S) and
  441. don't work for command line script execution
  442. </para>
  443. <para>
  444. There is no option for this backend.
  445. </para>
  446. </sect2>
  447. </sect1>
  448. <!--
  449. vim:se ts=4 sw=4 et:
  450. -->