Zend_Cache-Backends.xml 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803
  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 chosen 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>Directory where to store cache files</entry>
  34. </row>
  35. <row>
  36. <entry><emphasis>file_locking</emphasis></entry>
  37. <entry><type>Boolean</type></entry>
  38. <entry><constant>TRUE</constant></entry>
  39. <entry>
  40. Enable or disable file_locking : Can avoid cache corruption under
  41. bad circumstances but it doesn't help on multithread webservers
  42. or on <acronym>NFS</acronym> filesystems...
  43. </entry>
  44. </row>
  45. <row>
  46. <entry><emphasis>read_control</emphasis></entry>
  47. <entry><type>Boolean</type></entry>
  48. <entry><constant>TRUE</constant></entry>
  49. <entry>
  50. Enable / disable read control : if enabled, a control key is
  51. embedded in the cache file and this key is compared with the
  52. one calculated after the reading.
  53. </entry>
  54. </row>
  55. <row>
  56. <entry><emphasis>read_control_type</emphasis></entry>
  57. <entry><type>String</type></entry>
  58. <entry>'crc32'</entry>
  59. <entry>
  60. Type of read control (only if read control is enabled). Available values
  61. are : 'md5' (best but slowest), 'crc32' (lightly less safe but faster,
  62. better choice), 'adler32' (new choice, faster than crc32),
  63. 'strlen' for a length only test (fastest).
  64. </entry>
  65. </row>
  66. <row>
  67. <entry><emphasis>hashed_directory_level</emphasis></entry>
  68. <entry><type>Integer</type></entry>
  69. <entry>0</entry>
  70. <entry>
  71. Hashed directory structure level : 0 means "no hashed directory
  72. structure", 1 means "one level of directory", 2 means "two levels"...
  73. This option can speed up the cache only when you have many thousands of
  74. cache files. Only specific benchs can help you to choose the perfect
  75. value for you. Maybe, 1 or 2 is a good start.
  76. </entry>
  77. </row>
  78. <row>
  79. <entry><emphasis>hashed_directory_umask</emphasis></entry>
  80. <entry><type>Integer</type></entry>
  81. <entry>0700</entry>
  82. <entry>Umask for the hashed directory structure</entry>
  83. </row>
  84. <row>
  85. <entry><emphasis>file_name_prefix</emphasis></entry>
  86. <entry><type>String</type></entry>
  87. <entry>'zend_cache'</entry>
  88. <entry>
  89. prefix for cache files ; be really careful with this option because
  90. a too generic value in a system cache dir
  91. (like <filename>/tmp</filename>) can cause disasters when cleaning
  92. the cache
  93. </entry>
  94. </row>
  95. <row>
  96. <entry><emphasis>cache_file_umask</emphasis></entry>
  97. <entry><type>Integer</type></entry>
  98. <entry>0700</entry>
  99. <entry>umask for cache files</entry>
  100. </row>
  101. <row>
  102. <entry><emphasis>metatadatas_array_max_size</emphasis></entry>
  103. <entry><type>Integer</type></entry>
  104. <entry>100</entry>
  105. <entry>
  106. internal max size for the metadatas array (don't change this value
  107. unless you know what you are doing)
  108. </entry>
  109. </row>
  110. </tbody>
  111. </tgroup>
  112. </table>
  113. </sect2>
  114. <sect2 id="zend.cache.backends.sqlite">
  115. <title>Zend_Cache_Backend_Sqlite</title>
  116. <para>
  117. This (extended) backends stores cache records into a SQLite database.
  118. </para>
  119. <para>
  120. Available options are :
  121. </para>
  122. <table id="zend.cache.backends.sqlite.table">
  123. <title>Sqlite Backend Options</title>
  124. <tgroup cols="4">
  125. <thead>
  126. <row>
  127. <entry>Option</entry>
  128. <entry>Data Type</entry>
  129. <entry>Default Value</entry>
  130. <entry>Description</entry>
  131. </row>
  132. </thead>
  133. <tbody>
  134. <row>
  135. <entry><emphasis>cache_db_complete_path (mandatory)</emphasis></entry>
  136. <entry><type>String</type></entry>
  137. <entry><constant>NULL</constant></entry>
  138. <entry>
  139. The complete path (filename included) of the SQLite database
  140. </entry>
  141. </row>
  142. <row>
  143. <entry><emphasis>automatic_vacuum_factor</emphasis></entry>
  144. <entry><type>Integer</type></entry>
  145. <entry>10</entry>
  146. <entry>
  147. Disable / Tune the automatic vacuum process. The automatic vacuum
  148. process defragment the database file (and make it smaller) when a
  149. <methodname>clean()</methodname> or <methodname>delete()</methodname>
  150. is called: 0 means no automatic vacuum ; 1 means systematic vacuum
  151. (when <methodname>delete()</methodname> or
  152. <methodname>clean()</methodname> methods are called) ; x (integer) >
  153. 1 => automatic vacuum randomly 1 times on x
  154. <methodname>clean()</methodname> or
  155. <methodname>delete()</methodname>.
  156. </entry>
  157. </row>
  158. </tbody>
  159. </tgroup>
  160. </table>
  161. </sect2>
  162. <sect2 id="zend.cache.backends.memcached">
  163. <title>Zend_Cache_Backend_Memcached</title>
  164. <para>
  165. This (extended) backends stores cache records into a memcached server. <ulink
  166. url="http://www.danga.com/memcached/">memcached</ulink> is a high-performance,
  167. distributed memory object caching system. To use this backend, you need a memcached
  168. daemon and <ulink url="http://pecl.php.net/package/memcache">the memcache
  169. <acronym>PECL</acronym> 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><emphasis>servers</emphasis></entry>
  192. <entry><type>Array</type></entry>
  193. <entry>
  194. <command>array(array('host' => 'localhost', 'port' => 11211,
  195. 'persistent' => true, 'weight' => 1, 'timeout' => 5,
  196. 'retry_interval' => 15, 'status' => true,
  197. 'failure_callback' => '' ))</command>
  198. </entry>
  199. <entry>
  200. An array of memcached servers ; each memcached server is described by
  201. an associative array : 'host' => (string) : the name of the memcached
  202. server, 'port' => (int) : the port of the memcached server,
  203. 'persistent' => (bool) : use or not persistent connections to this
  204. memcached server 'weight' => (int) :the weight of the memcached
  205. server, '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
  209. memcached server
  210. </entry>
  211. </row>
  212. <row>
  213. <entry><emphasis>compression</emphasis></entry>
  214. <entry><type>Boolean</type></entry>
  215. <entry><constant>FALSE</constant></entry>
  216. <entry>
  217. <constant>TRUE</constant> if you want to use on-the-fly compression
  218. </entry>
  219. </row>
  220. <row>
  221. <entry><emphasis>compatibility</emphasis></entry>
  222. <entry><type>Boolean</type></entry>
  223. <entry><constant>FALSE</constant></entry>
  224. <entry>
  225. <constant>TRUE</constant> if you want to use this compatibility mode
  226. with old memcache servers or extensions
  227. </entry>
  228. </row>
  229. </tbody>
  230. </tgroup>
  231. </table>
  232. </sect2>
  233. <sect2 id="zend.cache.backends.apc">
  234. <title>Zend_Cache_Backend_Apc</title>
  235. <para>
  236. This (extended) backends stores cache records in shared memory through
  237. the <ulink url="http://pecl.php.net/package/APC">APC</ulink> (Alternative
  238. <acronym>PHP</acronym> Cache) extension (which is of course need for using this
  239. backend).
  240. </para>
  241. <para>
  242. Be careful : with this backend, "tags" are not supported for the moment as
  243. the "doNotTestCacheValidity=true" argument.
  244. </para>
  245. <para>
  246. There is no option for this backend.
  247. </para>
  248. </sect2>
  249. <sect2 id="zend.cache.backends.xcache">
  250. <title>Zend_Cache_Backend_Xcache</title>
  251. <para>
  252. This backends stores cache records in shared memory through
  253. the <ulink url="http://xcache.lighttpd.net/">XCache</ulink> extension
  254. (which is of course need for using this backend).
  255. </para>
  256. <para>
  257. Be careful : with this backend, "tags" are not supported for the moment as
  258. the "doNotTestCacheValidity=true" argument.
  259. </para>
  260. <para>
  261. Available options are :
  262. </para>
  263. <table id="zend.cache.backends.xcache.table">
  264. <title>Xcache Backend Options</title>
  265. <tgroup cols="4">
  266. <thead>
  267. <row>
  268. <entry>Option</entry>
  269. <entry>Data Type</entry>
  270. <entry>Default Value</entry>
  271. <entry>Description</entry>
  272. </row>
  273. </thead>
  274. <tbody>
  275. <row>
  276. <entry><emphasis>user</emphasis></entry>
  277. <entry><type>String</type></entry>
  278. <entry><constant>NULL</constant></entry>
  279. <entry>
  280. <filename>xcache.admin.user</filename>, necessary for the
  281. <methodname>clean()</methodname> method
  282. </entry>
  283. </row>
  284. <row>
  285. <entry><emphasis>password</emphasis></entry>
  286. <entry><type>String</type></entry>
  287. <entry><constant>NULL</constant></entry>
  288. <entry>
  289. <filename>xcache.admin.pass</filename> (in clear form, not
  290. <acronym>MD5</acronym>), necessary for the
  291. <methodname>clean()</methodname> method
  292. </entry>
  293. </row>
  294. </tbody>
  295. </tgroup>
  296. </table>
  297. </sect2>
  298. <sect2 id="zend.cache.backends.platform">
  299. <title>Zend_Cache_Backend_ZendPlatform</title>
  300. <para>
  301. This backend uses content caching <acronym>API</acronym> of the <ulink
  302. url="http://www.zend.com/en/products/platform/">Zend Platform</ulink> product.
  303. Naturally, to use this backend you need to have Zend Platform installed.
  304. </para>
  305. <para>
  306. This backend supports tags, but does not support
  307. <constant>CLEANING_MODE_NOT_MATCHING_TAG</constant> cleaning mode.
  308. </para>
  309. <para>
  310. Specify this backend using a word separator -- '-', '.', ' ', or '_'
  311. -- between the words 'Zend' and 'Platform' when using the
  312. <methodname>Zend_Cache::factory()</methodname> method:
  313. </para>
  314. <programlisting language="php"><![CDATA[
  315. $cache = Zend_Cache::factory('Core', 'Zend Platform');
  316. ]]></programlisting>
  317. <para>
  318. There are no options for this backend.
  319. </para>
  320. </sect2>
  321. <sect2 id="zend.cache.backends.twolevels">
  322. <title>Zend_Cache_Backend_TwoLevels</title>
  323. <para>
  324. This (extend) backend is an hybrid one. It stores cache records in two other backends :
  325. a fast one (but limited) like Apc, Memcache... and a "slow" one like File, Sqlite...
  326. </para>
  327. <para>
  328. This backend will use the priority parameter (given at the frontend level when storing a
  329. record) and the remaining space in the fast backend to optimize the usage of these two
  330. backends.
  331. </para>
  332. <para>
  333. Specify this backend using a word separator -- '-', '.', ' ', or '_'
  334. -- between the words 'Two' and 'Levels' when using the
  335. <methodname>Zend_Cache::factory()</methodname> method:
  336. </para>
  337. <programlisting language="php"><![CDATA[
  338. $cache = Zend_Cache::factory('Core', 'Two Levels');
  339. ]]></programlisting>
  340. <para>
  341. Available options are :
  342. </para>
  343. <table id="zend.cache.backends.twolevels.table">
  344. <title>TwoLevels Backend Options</title>
  345. <tgroup cols="4">
  346. <thead>
  347. <row>
  348. <entry>Option</entry>
  349. <entry>Data Type</entry>
  350. <entry>Default Value</entry>
  351. <entry>Description</entry>
  352. </row>
  353. </thead>
  354. <tbody>
  355. <row>
  356. <entry><emphasis>slow_backend</emphasis></entry>
  357. <entry><type>String</type></entry>
  358. <entry>File</entry>
  359. <entry>the "slow" backend name</entry>
  360. </row>
  361. <row>
  362. <entry><emphasis>fast_backend</emphasis></entry>
  363. <entry><type>String</type></entry>
  364. <entry>Apc</entry>
  365. <entry>the "fast" backend name</entry>
  366. </row>
  367. <row>
  368. <entry><emphasis>slow_backend_options</emphasis></entry>
  369. <entry><type>Array</type></entry>
  370. <entry><methodname>array()</methodname></entry>
  371. <entry>the "slow" backend options</entry>
  372. </row>
  373. <row>
  374. <entry><emphasis>fast_backend_options</emphasis></entry>
  375. <entry><type>Array</type></entry>
  376. <entry><methodname>array()</methodname></entry>
  377. <entry>the "fast" backend options</entry>
  378. </row>
  379. <row>
  380. <entry><emphasis>slow_backend_custom_naming</emphasis></entry>
  381. <entry><type>Boolean</type></entry>
  382. <entry><constant>FALSE</constant></entry>
  383. <entry>
  384. if <constant>TRUE</constant>, the slow_backend argument is used as a
  385. complete class name; if <constant>FALSE</constant>,
  386. the frontend argument is used as the end of
  387. "<classname>Zend_Cache_Backend_</classname>[...]" class name
  388. </entry>
  389. </row>
  390. <row>
  391. <entry><emphasis>fast_backend_custom_naming</emphasis></entry>
  392. <entry><type>Boolean</type></entry>
  393. <entry><constant>FALSE</constant></entry>
  394. <entry>
  395. if <constant>TRUE</constant>, the fast_backend argument is used as a
  396. complete class name; if <constant>FALSE</constant>,
  397. the frontend argument is used as the end of
  398. "<classname>Zend_Cache_Backend_</classname>[...]" class name
  399. </entry>
  400. </row>
  401. <row>
  402. <entry><emphasis>slow_backend_autoload</emphasis></entry>
  403. <entry><type>Boolean</type></entry>
  404. <entry><constant>FALSE</constant></entry>
  405. <entry>
  406. if <constant>TRUE</constant>, there will no require_once for the
  407. slow backend (useful only for custom backends)
  408. </entry>
  409. </row>
  410. <row>
  411. <entry><emphasis>fast_backend_autoload</emphasis></entry>
  412. <entry><type>Boolean</type></entry>
  413. <entry><constant>FALSE</constant></entry>
  414. <entry>
  415. if <constant>TRUE</constant>, there will no require_once for the fast
  416. backend (useful only for custom backends)
  417. </entry>
  418. </row>
  419. <row>
  420. <entry><emphasis>auto_refresh_fast_cache</emphasis></entry>
  421. <entry><type>Boolean</type></entry>
  422. <entry><constant>TRUE</constant></entry>
  423. <entry>
  424. if <constant>TRUE</constant>, auto refresh the fast cache when a
  425. cache record is hit
  426. </entry>
  427. </row>
  428. <row>
  429. <entry><emphasis>stats_update_factor</emphasis></entry>
  430. <entry><type>Integer</type></entry>
  431. <entry>10</entry>
  432. <entry>
  433. disable / tune the computation of the fast backend filling percentage
  434. (when saving a record into cache, computation of the fast backend
  435. filling percentage randomly 1 times on x cache writes)
  436. </entry>
  437. </row>
  438. </tbody>
  439. </tgroup>
  440. </table>
  441. </sect2>
  442. <sect2 id="zend.cache.backends.zendserver">
  443. <title>Zend_Cache_Backend_ZendServer_Disk and Zend_Cache_Backend_ZendServer_ShMem</title>
  444. <para>
  445. These backends store cache records using <ulink
  446. url="http://www.zend.com/en/products/server/downloads-all?zfs=zf_download">Zend
  447. Server</ulink> caching functionality.
  448. </para>
  449. <para>
  450. Be careful: with these backends, "tags" are not supported for the moment as the
  451. "doNotTestCacheValidity=true" argument.
  452. </para>
  453. <para>
  454. These backend work only withing Zend Server environment for pages requested through
  455. <acronym>HTTP</acronym> or <acronym>HTTPS</acronym> and don't work for command line
  456. script execution
  457. </para>
  458. <para>
  459. Specify this backend using parameter <emphasis>customBackendNaming</emphasis> as
  460. <constant>TRUE</constant> when using the <methodname>Zend_Cache::factory()</methodname>
  461. method:
  462. </para>
  463. <programlisting language="php"><![CDATA[
  464. $cache = Zend_Cache::factory('Core', 'Zend_Cache_Backend_ZendServer_Disk',
  465. $frontendOptions, $backendOptions, false, true);
  466. ]]></programlisting>
  467. <para>
  468. There is no option for this backend.
  469. </para>
  470. </sect2>
  471. <sect2 id="zend.cache.backends.static">
  472. <title>Zend_Cache_Backend_Static</title>
  473. <para>
  474. This backend works in concert with <classname>Zend_Cache_Frontend_Capture</classname>
  475. (the two must be used together) to save the output from requests as static files. This
  476. means the static files are served directly on subsequent requests without any
  477. involvement of <acronym>PHP</acronym> or Zend Framework at all.
  478. </para>
  479. <para>
  480. The benefits of this cache include a large throughput increase since
  481. all subsequent requests return the static file and don't need any
  482. dynamic processing. Of course this also has some disadvantages. The
  483. only way to retry the dynamic request is to purge the cached file
  484. from elsewhere in the application (or via a cronjob if timed). It
  485. is also restricted to single-server applications where only one
  486. filesystem is used. Nevertheless, it can be a powerful means of
  487. getting more performance without incurring the cost of a proxy on
  488. single machines.
  489. </para>
  490. <para>
  491. Before describing its options, you should note this needs some
  492. changes to the default <filename>.htaccess</filename> file in order for requests to be
  493. directed to the static files if they exist. Here's an example of
  494. a simple application caching some content, including two specific
  495. feeds which need additional treatment to serve a correct
  496. Content-Type header:
  497. </para>
  498. <programlisting language="text"><![CDATA[
  499. AddType application/rss+xml .xml
  500. AddType application/atom+xml .xml
  501. RewriteEngine On
  502. RewriteCond %{REQUEST_URI} feed/rss$
  503. RewriteCond %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}.xml -f
  504. RewriteRule .* cached/%{REQUEST_URI}.xml [L,T=application/rss+xml]
  505. RewriteCond %{REQUEST_URI} feed/atom$
  506. RewriteCond %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}.xml -f
  507. RewriteRule .* cached/%{REQUEST_URI}.xml [L,T=application/atom+xml]
  508. RewriteCond %{DOCUMENT_ROOT}/cached/index.html -f
  509. RewriteRule ^/*$ cached/index.html [L]
  510. RewriteCond %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}.(html|xml|json|opml|svg) -f
  511. RewriteRule .* cached/%{REQUEST_URI}.%1 [L]
  512. RewriteCond %{REQUEST_FILENAME} -s [OR]
  513. RewriteCond %{REQUEST_FILENAME} -l [OR]
  514. RewriteCond %{REQUEST_FILENAME} -d
  515. RewriteRule ^.*$ - [NC,L]
  516. RewriteRule ^.*$ index.php [NC,L]
  517. ]]></programlisting>
  518. <para>
  519. The above assumes static files are cached to the directory
  520. <filename>./public/cached</filename>. We'll cover the option setting this location,
  521. "public_dir", below.
  522. </para>
  523. <para>
  524. Due to the nature of static file caching, the backend class offers two additional
  525. methods: <methodname>remove()</methodname> and
  526. <methodname>removeRecursively()</methodname>. Both accept a request
  527. <acronym>URI</acronym>, which when mapped to the "public_dir" where static files are
  528. cached, and has a pre-stored extension appended, provides the name of either a static
  529. file to delete, or a directory path to delete recursively. Due to the
  530. restraints of <classname>Zend_Cache_Backend_Interface</classname>, all
  531. other methods such as <methodname>save()</methodname> accept an ID which
  532. is calculated by applying <methodname>bin2hex()</methodname> to a request
  533. <acronym>URI</acronym>.
  534. </para>
  535. <para>
  536. Given the level at which static caching operates, static file caching is addressed for
  537. simpler use with the <classname>Zend_Controller_Action_Helper_Cache</classname> action
  538. helper. This helper assists in setting which actions of a controller to cache, with what
  539. tags, and with which extension. It also offers methods for purging the cache by request
  540. <acronym>URI</acronym> or tag. Static file caching is also assisted by
  541. <classname>Zend_Cache_Manager</classname> which includes pre-configured configuration
  542. templates for a static cache (as <constant>Zend_Cache_Manager::PAGECACHE</constant> or
  543. "page"). The defaults therein can be configured as needed to set up a "public_dir"
  544. location for caching, etc.
  545. </para>
  546. <note>
  547. <para>
  548. It should be noted that the static cache actually uses a secondary cache to store
  549. tags (obviously we can't store them elsewhere since a static cache does not invoke
  550. <acronym>PHP</acronym> if working correctly). This is just a standard Core cache,
  551. and should use a persistent backend such as File or TwoLevels (to take advantage of
  552. memory storage without sacrificing permanent persistance). The backend includes the
  553. option "tag_cache" to set this up (it is obligatory), or the
  554. <methodname>setInnerCache()</methodname> method.
  555. </para>
  556. </note>
  557. <table id="zend.cache.backends.static.table">
  558. <title>Static Backend Options</title>
  559. <tgroup cols="4">
  560. <thead>
  561. <row>
  562. <entry>Option</entry>
  563. <entry>Data Type</entry>
  564. <entry>Default Value</entry>
  565. <entry>Description</entry>
  566. </row>
  567. </thead>
  568. <tbody>
  569. <row>
  570. <entry><emphasis>public_dir</emphasis></entry>
  571. <entry><type>String</type></entry>
  572. <entry><constant>NULL</constant></entry>
  573. <entry>
  574. Directory where to store static files. This must exist
  575. in your public directory.
  576. </entry>
  577. </row>
  578. <row>
  579. <entry><emphasis>file_locking</emphasis></entry>
  580. <entry><type>Boolean</type></entry>
  581. <entry><constant>TRUE</constant></entry>
  582. <entry>
  583. Enable or disable file_locking : Can avoid cache corruption under
  584. bad circumstances but it doesn't help on multithread webservers
  585. or on <acronym>NFS</acronym> filesystems...
  586. </entry>
  587. </row>
  588. <row>
  589. <entry><emphasis>read_control</emphasis></entry>
  590. <entry><type>Boolean</type></entry>
  591. <entry><constant>TRUE</constant></entry>
  592. <entry>
  593. Enable / disable read control : if enabled, a control key is
  594. embedded in the cache file and this key is compared with the
  595. one calculated after the reading.
  596. </entry>
  597. </row>
  598. <row>
  599. <entry><emphasis>read_control_type</emphasis></entry>
  600. <entry><type>String</type></entry>
  601. <entry>'crc32'</entry>
  602. <entry>
  603. Type of read control (only if read control is enabled). Available values
  604. are : 'md5' (best but slowest), 'crc32' (lightly less safe but faster,
  605. better choice), 'adler32' (new choice, faster than crc32),
  606. 'strlen' for a length only test (fastest).
  607. </entry>
  608. </row>
  609. <row>
  610. <entry><emphasis>cache_file_umask</emphasis></entry>
  611. <entry><type>Integer</type></entry>
  612. <entry>0700</entry>
  613. <entry>umask for cached files.</entry>
  614. </row>
  615. <row>
  616. <entry><emphasis>cache_directory_umask</emphasis></entry>
  617. <entry><type>Integer</type></entry>
  618. <entry>0700</entry>
  619. <entry>Umask for directories created within public_dir.</entry>
  620. </row>
  621. <row>
  622. <entry><emphasis>file_extension</emphasis></entry>
  623. <entry><type>String</type></entry>
  624. <entry>'<filename>.html</filename>'</entry>
  625. <entry>
  626. Default file extension for static files created. This can be
  627. configured on the fly, see
  628. <methodname>Zend_Cache_Backend_Static::save()</methodname> though
  629. generally it's recommended to rely on
  630. <classname>Zend_Controller_Action_Helper_Cache</classname> when
  631. doing so since it's simpler that way than messing with
  632. arrays or serialization manually.
  633. </entry>
  634. </row>
  635. <row>
  636. <entry><emphasis>index_filename</emphasis></entry>
  637. <entry><type>String</type></entry>
  638. <entry>'index'</entry>
  639. <entry>
  640. If a request <acronym>URI</acronym> does not contain sufficient
  641. information to construct a static file (usually this means an index
  642. call, e.g. <acronym>URI</acronym> of '/'), the index_filename is used
  643. instead. So '' or '/' would map to '<filename>index.html</filename>'
  644. (assuming the default file_extension is '<filename>.html</filename>').
  645. </entry>
  646. </row>
  647. <row>
  648. <entry><emphasis>tag_cache</emphasis></entry>
  649. <entry><type>Object</type></entry>
  650. <entry><constant>NULL</constant></entry>
  651. <entry>
  652. Used to set an 'inner' cache utilised to store tags
  653. and file extensions associated with static files. This
  654. <emphasis>must</emphasis> be set or the static cache cannot be tracked
  655. and managed.
  656. </entry>
  657. </row>
  658. <row>
  659. <entry><emphasis>disable_caching</emphasis></entry>
  660. <entry><type>Boolean</type></entry>
  661. <entry><constant>FALSE</constant></entry>
  662. <entry>
  663. If set to <constant>TRUE</constant>, static files will not be cached.
  664. This will force all requests to be dynamic even if marked
  665. to be cached in Controllers. Useful for debugging.
  666. </entry>
  667. </row>
  668. </tbody>
  669. </tgroup>
  670. </table>
  671. </sect2>
  672. </sect1>
  673. <!--
  674. vim:se ts=4 sw=4 et:
  675. -->