Zend_Cache-Backends.xml 23 KB

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