Zend_Cache-Backends.xml 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  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. <sect2 id="zend.cache.backends.static">
  486. <title>Zend_Cache_Backend_Static</title>
  487. <para>
  488. This backend works in concert with <classname>Zend_Cache_Frontend_Capture</classname>
  489. (the two must be used together) to save the output from requests as static files. This
  490. means the static files are served directly on subsequent requests without any
  491. involvement of <acronym>PHP</acronym> or Zend Framework at all.
  492. </para>
  493. <para>
  494. The benefits of this cache include a large throughput increase since
  495. all subsequent requests return the static file and don't need any
  496. dynamic processing. Of course this also has some disadvantages. The
  497. only way to retry the dynamic request is to purge the cached file
  498. from elsewhere in the application (or via a cronjob if timed). It
  499. is also restricted to single-server applications where only one
  500. filesystem is used. Nevertheless, it can be a powerful means of
  501. getting more performance without incurring the cost of a proxy on
  502. single machines.
  503. </para>
  504. <para>
  505. Before describing its options, you should note this needs some
  506. changes to the default <filename>.htaccess</filename> file in order for requests to be
  507. directed to the static files if they exist. Here's an example of
  508. a simple application caching some content, including two specific
  509. feeds which need additional treatment to serve a correct
  510. Content-Type header:
  511. </para>
  512. <programlisting language="text"><![CDATA[
  513. AddType application/rss+xml .xml
  514. AddType application/atom+xml .xml
  515. RewriteEngine On
  516. RewriteCond %{REQUEST_URI} feed/rss$
  517. RewriteCond %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}.xml -f
  518. RewriteRule .* cached/%{REQUEST_URI}.xml [L,T=application/rss+xml]
  519. RewriteCond %{REQUEST_URI} feed/atom$
  520. RewriteCond %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}.xml -f
  521. RewriteRule .* cached/%{REQUEST_URI}.xml [L,T=application/atom+xml]
  522. RewriteCond %{DOCUMENT_ROOT}/cached/index.html -f
  523. RewriteRule ^/*$ cached/index.html [L]
  524. RewriteCond %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}.(html|xml|json|opml|svg) -f
  525. RewriteRule .* cached/%{REQUEST_URI}.%1 [L]
  526. RewriteCond %{REQUEST_FILENAME} -s [OR]
  527. RewriteCond %{REQUEST_FILENAME} -l [OR]
  528. RewriteCond %{REQUEST_FILENAME} -d
  529. RewriteRule ^.*$ - [NC,L]
  530. RewriteRule ^.*$ index.php [NC,L]
  531. ]]></programlisting>
  532. <para>
  533. The above assumes static files are cached to the directory
  534. <filename>./public/cached</filename>. We'll cover the option setting this location,
  535. "public_dir", below.
  536. </para>
  537. <para>
  538. Due to the nature of static file caching, the backend class offers two additional
  539. methods: <methodname>remove()</methodname> and
  540. <methodname>removeRecursively()</methodname>. Both accept a request
  541. <acronym>URI</acronym>, which when mapped to the "public_dir" where static files are
  542. cached, and has a pre-stored extension appended, provides the name of either a static
  543. file to delete, or a directory path to delete recursively. Due to the
  544. restraints of <classname>Zend_Cache_Backend_Interface</classname>, all
  545. other methods such as <methodname>save()</methodname> accept an ID which
  546. is calculated by applying <methodname>bin2hex()</methodname> to a request
  547. <acronym>URI</acronym>.
  548. </para>
  549. <para>
  550. Given the level at which static caching operates, static file caching is addressed for
  551. simpler use with the <classname>Zend_Controller_Action_Helper_Cache</classname> action
  552. helper. This helper assists in setting which actions of a controller to cache, with what
  553. tags, and with which extension. It also offers methods for purging the cache by request
  554. <acronym>URI</acronym> or tag. Static file caching is also assisted by
  555. <classname>Zend_Cache_Manager</classname> which includes pre-configured configuration
  556. templates for a static cache (as <constant>Zend_Cache_Manager::PAGECACHE</constant> or
  557. "page"). The defaults therein can be configured as needed to set up a "public_dir"
  558. location for caching, etc.
  559. </para>
  560. <note>
  561. <para>
  562. It should be noted that the static cache actually uses a secondary cache to store
  563. tags (obviously we can't store them elsewhere since a static cache does not invoke
  564. <acronym>PHP</acronym> if working correctly). This is just a standard Core cache, and
  565. should use a persistent backend such as File or TwoLevels (to take advantage of
  566. memory storage without sacrificing permanent persistance). The backend includes the
  567. option "tag_cache" to set this up (it is obligatory), or the
  568. <methodname>setInnerCache()</methodname> method.
  569. </para>
  570. </note>
  571. <table id="zend.cache.backends.static.table">
  572. <title>Static Backend Options</title>
  573. <tgroup cols="4">
  574. <thead>
  575. <row>
  576. <entry>Option</entry>
  577. <entry>Data Type</entry>
  578. <entry>Default Value</entry>
  579. <entry>Description</entry>
  580. </row>
  581. </thead>
  582. <tbody>
  583. <row>
  584. <entry><emphasis>public_dir</emphasis></entry>
  585. <entry><type>String</type></entry>
  586. <entry><constant>NULL</constant></entry>
  587. <entry>
  588. Directory where to store static files. This must exist
  589. in your public directory.
  590. </entry>
  591. </row>
  592. <row>
  593. <entry><emphasis>file_locking</emphasis></entry>
  594. <entry><type>Boolean</type></entry>
  595. <entry><constant>TRUE</constant></entry>
  596. <entry>
  597. Enable or disable file_locking : Can avoid cache corruption under
  598. bad circumstances but it doesn't help on multithread webservers
  599. or on <acronym>NFS</acronym> filesystems...
  600. </entry>
  601. </row>
  602. <row>
  603. <entry><emphasis>read_control</emphasis></entry>
  604. <entry><type>Boolean</type></entry>
  605. <entry><constant>TRUE</constant></entry>
  606. <entry>
  607. Enable / disable read control : if enabled, a control key is
  608. embedded in the cache file and this key is compared with the
  609. one calculated after the reading.
  610. </entry>
  611. </row>
  612. <row>
  613. <entry><emphasis>read_control_type</emphasis></entry>
  614. <entry><type>String</type></entry>
  615. <entry>'crc32'</entry>
  616. <entry>
  617. Type of read control (only if read control is enabled). Available values
  618. are : 'md5' (best but slowest), 'crc32' (lightly less safe but faster,
  619. better choice), 'adler32' (new choice, faster than crc32),
  620. 'strlen' for a length only test (fastest).
  621. </entry>
  622. </row>
  623. <row>
  624. <entry><emphasis>cache_file_umask</emphasis></entry>
  625. <entry><type>Integer</type></entry>
  626. <entry>0700</entry>
  627. <entry>
  628. umask for cached files.
  629. </entry>
  630. </row>
  631. <row>
  632. <entry><emphasis>cache_directory_umask</emphasis></entry>
  633. <entry><type>Integer</type></entry>
  634. <entry>0700</entry>
  635. <entry>
  636. Umask for directories created within public_dir.
  637. </entry>
  638. </row>
  639. <row>
  640. <entry><emphasis>file_extension</emphasis></entry>
  641. <entry><type>String</type></entry>
  642. <entry>'<filename>.html</filename>'</entry>
  643. <entry>
  644. Default file extension for static files created. This can be
  645. configured on the fly, see
  646. <methodname>Zend_Cache_Backend_Static::save()</methodname> though
  647. generally it's recommended to rely on
  648. <classname>Zend_Controller_Action_Helper_Cache</classname> when
  649. doing so since it's simpler that way than messing with
  650. arrays or serialization manually.
  651. </entry>
  652. </row>
  653. <row>
  654. <entry><emphasis>index_filename</emphasis></entry>
  655. <entry><type>String</type></entry>
  656. <entry>'index'</entry>
  657. <entry>
  658. If a request <acronym>URI</acronym> does not contain sufficient
  659. information to construct a static file (usually this means an index
  660. call, e.g. <acronym>URI</acronym> of '/'), the index_filename is used
  661. instead. So '' or '/' would map to '<filename>index.html</filename>'
  662. (assuming the default file_extension is '<filename>.html</filename>').
  663. </entry>
  664. </row>
  665. <row>
  666. <entry><emphasis>tag_cache</emphasis></entry>
  667. <entry><type>Object</type></entry>
  668. <entry><constant>NULL</constant></entry>
  669. <entry>
  670. Used to set an 'inner' cache utilised to store tags
  671. and file extensions associated with static files. This
  672. <emphasis>must</emphasis> be set or the static cache cannot be tracked
  673. and managed.
  674. </entry>
  675. </row>
  676. <row>
  677. <entry><emphasis>disable_caching</emphasis></entry>
  678. <entry><type>Boolean</type></entry>
  679. <entry><constant>FALSE</constant></entry>
  680. <entry>
  681. If set to <constant>TRUE</constant>, static files will not be cached.
  682. This will force all requests to be dynamic even if marked
  683. to be cached in Controllers. Useful for debugging.
  684. </entry>
  685. </row>
  686. </tbody>
  687. </tgroup>
  688. </table>
  689. </sect2>
  690. </sect1>
  691. <!--
  692. vim:se ts=4 sw=4 et:
  693. -->