Zend_Cache-Backends.xml 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- EN-Revision: 24677 -->
  3. <!-- Reviewed: no -->
  4. <sect1 id="zend.cache.backends">
  5. <title>Les backends Zend_Cache</title>
  6. <para>
  7. Il existe deux types de backends&#160;: les standards et les étendus. Bien sûr, les
  8. backends étendus offrent des fonctionnalités supplémentaires.
  9. </para>
  10. <sect2 id="zend.cache.backends.file">
  11. <title>Zend_Cache_Backend_File</title>
  12. <para>
  13. Ces backends (étendus) stockent les enregistrements de cache dans des fichiers
  14. (dans un dossier choisi).
  15. </para>
  16. <para>Les options disponibles sont&#160;:</para>
  17. <table id="zend.cache.backends.file.table">
  18. <title>Options du backend File</title>
  19. <tgroup cols="4">
  20. <thead>
  21. <row>
  22. <entry>Option</entry>
  23. <entry>Type de données</entry>
  24. <entry>Valeur par défaut</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>[system temp dir]</entry>
  33. <entry>Répertoire où stocker les fichiers de cache</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. Active / désactive le verrou de fichier&#160;: peut éviter la
  41. corruption du cache dans de mauvaises circonstances, mais il n'aide en
  42. rien sur des serveur multithreadés ou sur des systèmes de fichier
  43. <acronym>NFS</acronym>...
  44. </entry>
  45. </row>
  46. <row>
  47. <entry><emphasis>read_control</emphasis></entry>
  48. <entry><type>Boolean</type></entry>
  49. <entry><constant>TRUE</constant></entry>
  50. <entry>
  51. Active / désactive le contrôle de lecture&#160;: si activé, une clé
  52. de contrôle est embarquée dans le fichier de cache et cette clé est
  53. comparée avec celle calculée après la lecture.
  54. </entry>
  55. </row>
  56. <row>
  57. <entry><emphasis>read_control_type</emphasis></entry>
  58. <entry><type>String</type></entry>
  59. <entry>'crc32'</entry>
  60. <entry>
  61. Type de contrôle de lecture (seulement si le contrôle de lecture
  62. est activé). Les valeurs disponibles sont&#160;: "md5" (meilleur mais
  63. plus lent), "crc32" (un peu moins sécurisé, mais plus rapide, c'est un
  64. meilleur choix), "adler32" (nouveau choix, plus rapide que
  65. crc32),"strlen" pour un test de longueur uniquement (le plus
  66. rapide).
  67. </entry>
  68. </row>
  69. <row>
  70. <entry><emphasis>hashed_directory_level</emphasis></entry>
  71. <entry><type>Integer</type></entry>
  72. <entry>0</entry>
  73. <entry>
  74. Niveau de structure du hash du répertoire&#160;: 0 signifie "pas de
  75. hashage de la structure du répertoire", 1 signifie "un niveau de
  76. répertoire", 2 signifie "deux niveaux"... Cette option peut accélérer
  77. le cache seulement lorsque vous avez plusieurs centaines de fichiers de
  78. cache. Seuls des tests de performance spécifiques peuvent vous aider à
  79. choisir la meilleure valeur pour vous. 1 ou 2, peut-être un bon
  80. départ.
  81. </entry>
  82. </row>
  83. <row>
  84. <entry><emphasis>hashed_directory_perm</emphasis></entry>
  85. <entry><type>Integer</type></entry>
  86. <entry>0700</entry>
  87. <entry>Permissions pour l'arborescence</entry>
  88. </row>
  89. <row>
  90. <entry><emphasis>file_name_prefix</emphasis></entry>
  91. <entry><type>String</type></entry>
  92. <entry>'zend_cache'</entry>
  93. <entry>
  94. Préfixe pour les fichiers mis en cache&#160;; faîtes très attention
  95. avec cette option, en cas de valeur trop générique dans le dossier de
  96. cache (comme <filename>/tmp</filename>), ceci peut causer des désastres
  97. lors du nettoyage du cache.
  98. </entry>
  99. </row>
  100. <row>
  101. <entry><emphasis>cache_file_umask</emphasis></entry>
  102. <entry><type>Integer</type></entry>
  103. <entry>0600</entry>
  104. <entry>umask des fichiers de cache.</entry>
  105. </row>
  106. <row>
  107. <entry><emphasis>cache_file_perm</emphasis></entry>
  108. <entry><type>Integer</type></entry>
  109. <entry>0600</entry>
  110. <entry>Permissions des fichiers de cache.</entry>
  111. </row>
  112. <row>
  113. <entry><emphasis>metatadatas_array_max_size</emphasis></entry>
  114. <entry><type>Integer</type></entry>
  115. <entry>100</entry>
  116. <entry>
  117. Taille maximale interne pour les tableaux de métadonnées (ne
  118. changez pas cette valeur à moins de bien savoir ce que vous
  119. faîtes).
  120. </entry>
  121. </row>
  122. </tbody>
  123. </tgroup>
  124. </table>
  125. </sect2>
  126. <sect2 id="zend.cache.backends.sqlite">
  127. <title>Zend_Cache_Backend_Sqlite</title>
  128. <para>
  129. Ce backend (étendu) stocke les enregistrements de cache dans une base de donnée
  130. SQLite.
  131. </para>
  132. <para>Les options disponibles sont&#160;:</para>
  133. <table id="zend.cache.backends.sqlite.table">
  134. <title>Options du backend Sqlite</title>
  135. <tgroup cols="4">
  136. <thead>
  137. <row>
  138. <entry>Option</entry>
  139. <entry>Type de données</entry>
  140. <entry>Valeur par défaut</entry>
  141. <entry>Description</entry>
  142. </row>
  143. </thead>
  144. <tbody>
  145. <row>
  146. <entry><emphasis>cache_db_complete_path (obligatoire)</emphasis></entry>
  147. <entry><type>String</type></entry>
  148. <entry><constant>NULL</constant></entry>
  149. <entry>
  150. Le chemin complet (nom du fichier inclus) de la base de donnée
  151. SQLite
  152. </entry>
  153. </row>
  154. <row>
  155. <entry><emphasis>automatic_vacuum_factor</emphasis></entry>
  156. <entry><type>Integer</type></entry>
  157. <entry>10</entry>
  158. <entry>
  159. Désactive / Active le processus de vidange automatique. Celui-ci
  160. défragmente le fichier de base de données (et diminue sa taille) quand
  161. <methodname>clean()</methodname> ou <methodname>delete()</methodname>
  162. est appelé&#160;: 0 pour une vidange automatique&#160;; 1
  163. pour une vidange systématique (quand <methodname>clean()</methodname>
  164. ou <methodname>delete()</methodname> est
  165. appelé)&#160;; x (entier) &gt; 1 pour une vidange automatique
  166. aléatoirement 1 fois sur x <methodname>clean()</methodname> ou
  167. <methodname>delete()</methodname>.
  168. </entry>
  169. </row>
  170. </tbody>
  171. </tgroup>
  172. </table>
  173. </sect2>
  174. <sect2 id="zend.cache.backends.memcached">
  175. <title>Zend_Cache_Backend_Memcached</title>
  176. <para>
  177. Ce backend (étendu) stocke les enregistrements de cache dans un serveur memcached.
  178. <ulink url="http://www.danga.com/memcached/">Memcached</ulink> est un système de cache
  179. en mémoire distribuée, de haute performance. Pour utiliser ce backend, vous devez avoir
  180. un démon memcached et l'extension
  181. <ulink url="http://pecl.php.net/package/memcache"><acronym>PECL</acronym>
  182. memcache</ulink>.
  183. </para>
  184. <para>
  185. Attention : avec ce backend, les balises ("tags") ne sont pas supportées pour le
  186. moment comme l'argument "doNotTestCacheValidity=true".
  187. </para>
  188. <para>Les options disponibles sont&#160;:</para>
  189. <table id="zend.cache.backends.memcached.table">
  190. <title>Options du backend Memcached</title>
  191. <tgroup cols="4">
  192. <thead>
  193. <row>
  194. <entry>Option</entry>
  195. <entry>Type de données</entry>
  196. <entry>Valeur par défaut</entry>
  197. <entry>Description</entry>
  198. </row>
  199. </thead>
  200. <tbody>
  201. <row>
  202. <entry><emphasis>servers</emphasis></entry>
  203. <entry><type>Array</type></entry>
  204. <entry>
  205. <command>array(array('host' => 'localhost', 'port' => 11211,
  206. 'persistent' => true, 'weight' => 1, 'timeout' => 5,
  207. 'retry_interval' => 15, 'status' => true,
  208. 'failure_callback' => '' ))</command>
  209. </entry>
  210. <entry>
  211. Un tableau de serveurs memcached&#160;; chaque serveur memcached est
  212. décrit par un tableau associatif&#160;: 'host' =&gt; (string)&#160;: le
  213. nom du serveur memcached, 'port' =&gt; (int)&#160;: le port du serveur
  214. memcached, 'persistent' =&gt; (bool)&#160;: utilisation ou pas des
  215. connexions persistantes pour ce serveur memcached, 'weight' =&gt;
  216. (int)&#160;: le poids du serveur memcached, 'timeout' =&gt;
  217. (int)&#160;: le time out du serveur memcached, 'retry_interval' =&gt;
  218. (int)&#160;: l'intervalle avant réexécution du serveur memcached,
  219. 'status' =&gt; (bool)&#160;: le statut du serveur memcached,
  220. 'failure_callback' =&gt; (callback)&#160;: le failure_callback d'échec
  221. du serveur memcached.
  222. </entry>
  223. </row>
  224. <row>
  225. <entry><emphasis>compression</emphasis></entry>
  226. <entry><type>Boolean</type></entry>
  227. <entry><constant>FALSE</constant></entry>
  228. <entry>
  229. <constant>TRUE</constant>, si vous voulez utiliser la compression à la
  230. volée
  231. </entry>
  232. </row>
  233. <row>
  234. <entry><emphasis>compatibility</emphasis></entry>
  235. <entry><type>Boolean</type></entry>
  236. <entry><constant>FALSE</constant></entry>
  237. <entry>
  238. <constant>TRUE</constant>, si vous voulez utiliser le mode de
  239. compatibilité avec les anciens serveurs&#160;/&#160;extensions memcache
  240. </entry>
  241. </row>
  242. </tbody>
  243. </tgroup>
  244. </table>
  245. </sect2>
  246. <sect2 id="zend.cache.backends.libmemcached">
  247. <title>Zend_Cache_Backend_Libmemcached</title>
  248. <para>
  249. Ce backend (étendu) stocke les enregistrements de cache dans un serveur memcached.
  250. <ulink url="http://www.danga.com/memcached/">memcached</ulink> est un système distribué
  251. de cache d'objet en mémoire de haute performance. Pour utiliser ce backend, vous avez
  252. besoin d'un démon memcached et de l'extension
  253. <ulink url="http://pecl.php.net/package/memcached"><acronym>PECL</acronym>
  254. memcached</ulink>.
  255. </para>
  256. <para>
  257. Attention: avec ce backend, les balises ("tags") ne sont pas supportées pour le
  258. moment comme l'argument "doNotTestCacheValidity=true".
  259. </para>
  260. <para>Les options disponibles sont&#160;:</para>
  261. <table id="zend.cache.backends.libmemcached.table">
  262. <title>Options du backend Libmemcached</title>
  263. <tgroup cols="4">
  264. <thead>
  265. <row>
  266. <entry>Option</entry>
  267. <entry>Type de données</entry>
  268. <entry>Valeur par défaut</entry>
  269. <entry>Description</entry>
  270. </row>
  271. </thead>
  272. <tbody>
  273. <row>
  274. <entry><emphasis>servers</emphasis></entry>
  275. <entry>
  276. <type>Array</type>
  277. </entry>
  278. <entry>
  279. <command>array(array('host' =&gt; 'localhost', 'port' =&gt; 11211,
  280. 'weight' =&gt; 1))</command>
  281. </entry>
  282. <entry>
  283. Un tableau de serveurs memcached&#160;; chaque serveur memcached est
  284. décrit par un tableau associatif&#160;: 'host' =&gt; (string)&#160;: le
  285. nom du serveur memcached, 'port' =&gt; (int)&#160;: le port du serveur
  286. memcached, 'weight' =&gt; (int)&#160;: le poids du serveur memcached.
  287. </entry>
  288. </row>
  289. <row>
  290. <entry><emphasis>client</emphasis></entry>
  291. <entry>
  292. <type>Array</type>
  293. </entry>
  294. <entry>
  295. <command>array( Memcached::OPT_DISTRIBUTION =&gt;
  296. Memcached::DISTRIBUTION_CONSISTENT, Memcached::OPT_HASH =&gt;
  297. Memcached::HASH_MD5, Memcached::OPT_LIBKETAMA_COMPATIBLE =&gt; true
  298. )</command>
  299. </entry>
  300. <entry>
  301. Un tableau associatif des options de client memcached. Les clés du
  302. tableau peuvent le nom de la constante d'option memcache (sans le OPT_)
  303. ou la valeur de type entier de celui-ci. Voir aussi
  304. <ulink url="http://php.net/manual/memcached.constants.php">les
  305. constantes Memcached dans le manuel <acronym>PHP</acronym></ulink>
  306. </entry>
  307. </row>
  308. </tbody>
  309. </tgroup>
  310. </table>
  311. </sect2>
  312. <sect2 id="zend.cache.backends.apc">
  313. <title>Zend_Cache_Backend_Apc</title>
  314. <para>
  315. Ce backend (étendu) stocke les enregistrements de cache en mémoire partagée grâce
  316. à l'extension <ulink url="http://pecl.php.net/package/APC">APC</ulink>
  317. (Alternative <acronym>PHP</acronym> Cache) qui est requise pour utiliser ce backend.
  318. </para>
  319. <para>
  320. Attention: avec ce backend, les balises ("tags") ne sont pas supportées pour le
  321. moment comme l'argument "doNotTestCacheValidity=true".
  322. </para>
  323. <para>Il n'y a pas d'options pour ce backend.</para>
  324. </sect2>
  325. <sect2 id="zend.cache.backends.xcache">
  326. <title>Zend_Cache_Backend_Xcache</title>
  327. <para>
  328. Ce backend stocke ces enregistrements de cache dans la mémoire partagée à travers
  329. l'extension <ulink url="http://xcache.lighttpd.net/">XCache</ulink>(qui est bien sûr
  330. nécessaire pour utiliser ce backend).
  331. </para>
  332. <para>
  333. Attention : avec ce backend, les balises ("tags") ne sont pas supportées pour le
  334. moment comme l'argument "doNotTestCacheValidity=true".
  335. </para>
  336. <para>Les options disponibles sont&#160;:</para>
  337. <table id="zend.cache.backends.xcache.table">
  338. <title>Options du backend Xcache</title>
  339. <tgroup cols="4">
  340. <thead>
  341. <row>
  342. <entry>Option</entry>
  343. <entry>Type de données</entry>
  344. <entry>Valeur par défaut</entry>
  345. <entry>Description</entry>
  346. </row>
  347. </thead>
  348. <tbody>
  349. <row>
  350. <entry><emphasis>user</emphasis></entry>
  351. <entry><type>String</type></entry>
  352. <entry><constant>NULL</constant></entry>
  353. <entry>
  354. <filename>xcache.admin.user</filename>, nécessaire pour la
  355. méthode <methodname>clean()</methodname>.
  356. </entry>
  357. </row>
  358. <row>
  359. <entry><emphasis>password</emphasis></entry>
  360. <entry><type>String</type></entry>
  361. <entry><constant>NULL</constant></entry>
  362. <entry>
  363. <filename>xcache.admin.pass</filename> (en texte clair non
  364. <acronym>MD5</acronym>), nécessaire pour la méthode
  365. <methodname>clean()</methodname>.
  366. </entry>
  367. </row>
  368. </tbody>
  369. </tgroup>
  370. </table>
  371. </sect2>
  372. <sect2 id="zend.cache.backends.platform">
  373. <title>Zend_Cache_Backend_ZendPlatform</title>
  374. <para>
  375. Ce backend utilise l'<acronym>API</acronym> de cache de contenu de la
  376. <ulink url="http://www.zend.com/fr/products/platform">Zend Platform</ulink>.
  377. Naturellement, pour utiliser ce backend, vous devez avoir installé une Zend Platorm.
  378. </para>
  379. <para>
  380. Ce backend supporte les balises ("tags") mais ne supporte pas le mode de
  381. nettoyage <constant>CLEANING_MODE_NOT_MATCHING_TAG</constant>.
  382. </para>
  383. <para>
  384. Spécifiez ce backend en utilisant un séparateur de mot - "-", ".", " " ou "_" -
  385. entre les mots "Zend" et "Platform" quand vous utilisez la méthode
  386. <methodname>Zend_Cache::factory()</methodname>&#160;:
  387. </para>
  388. <programlisting language="php"><![CDATA[
  389. $cache = Zend_Cache::factory('Core', 'Zend Platform');
  390. ]]></programlisting>
  391. <para>Il n'y a pas d'options pour ce backend.</para>
  392. </sect2>
  393. <sect2 id="zend.cache.backends.twolevels">
  394. <title>Zend_Cache_Backend_TwoLevels</title>
  395. <para>
  396. Ce backend (étendu) est un hybride. Il stocke les enregistrements de cache dans
  397. deux autres backends&#160;: un rapide (mais limité) comme Apc, Memcache... et un plus
  398. "lent" comme File, Sqlite...
  399. </para>
  400. <para>
  401. Ce backend utilise le paramètre priorité (fourni au niveau du frontend au moment
  402. d'un enregistrement) et l'espace restant dans le backend rapide pour optimiser
  403. l'utilisation de ces deux backends.
  404. </para>
  405. <para>
  406. Spécifiez ce backend avec un séparateur de mots - "-", ".", " ", ou "_" - entre les
  407. mots "Two" et "Levels" quand vous utilisez la méthode
  408. <methodname>Zend_Cache::factory()</methodname>&#160;:
  409. </para>
  410. <programlisting language="php"><![CDATA[
  411. $cache = Zend_Cache::factory('Core', 'Two Levels');
  412. ]]></programlisting>
  413. <para>Les options disponibles sont :</para>
  414. <table id="zend.cache.backends.twolevels.table">
  415. <title>Options du backend TwoLevels</title>
  416. <tgroup cols="4">
  417. <thead>
  418. <row>
  419. <entry>Option</entry>
  420. <entry>Type de données</entry>
  421. <entry>Valeur par défaut</entry>
  422. <entry>Description</entry>
  423. </row>
  424. </thead>
  425. <tbody>
  426. <row>
  427. <entry><emphasis>slow_backend</emphasis></entry>
  428. <entry><type>String</type></entry>
  429. <entry>File</entry>
  430. <entry>le nom du backend "lent"</entry>
  431. </row>
  432. <row>
  433. <entry><emphasis>fast_backend</emphasis></entry>
  434. <entry><type>String</type></entry>
  435. <entry>Apc</entry>
  436. <entry>le nom du backend "rapide"</entry>
  437. </row>
  438. <row>
  439. <entry><emphasis>slow_backend_options</emphasis></entry>
  440. <entry><type>Array</type></entry>
  441. <entry><methodname>array()</methodname></entry>
  442. <entry>les options du backend "lent"</entry>
  443. </row>
  444. <row>
  445. <entry><emphasis>fast_backend_options</emphasis></entry>
  446. <entry><type>Array</type></entry>
  447. <entry><methodname>array()</methodname></entry>
  448. <entry>les options du backend "rapide"</entry>
  449. </row>
  450. <row>
  451. <entry><emphasis>slow_backend_custom_naming</emphasis></entry>
  452. <entry><type>Boolean</type></entry>
  453. <entry><constant>FALSE</constant></entry>
  454. <entry>
  455. si <constant>TRUE</constant>, l'argument "slow_backend" est
  456. utilisé en tant que nom complet de classe&#160;; si
  457. <constant>FALSE</constant>, l'argument frontend est utilisé concaténé à
  458. "<classname>Zend_Cache_Backend_&lt;...&gt;</classname>"
  459. </entry>
  460. </row>
  461. <row>
  462. <entry><emphasis>fast_backend_custom_naming</emphasis></entry>
  463. <entry><type>Boolean</type></entry>
  464. <entry><constant>FALSE</constant></entry>
  465. <entry>
  466. si <constant>TRUE</constant>, l'argument "fast_backend" est
  467. utilisé en tant que nom complet de classe&#160;; si
  468. <constant>FALSE</constant>, l'argument frontend est utilisé concaténé à
  469. "<classname>Zend_Cache_Backend_&lt;...&gt;</classname>"
  470. </entry>
  471. </row>
  472. <row>
  473. <entry><emphasis>slow_backend_autoload</emphasis></entry>
  474. <entry><type>Boolean</type></entry>
  475. <entry><constant>FALSE</constant></entry>
  476. <entry>
  477. si <constant>TRUE</constant>, il n'y aura pas de require_once pour le
  478. "slow_backend" (utile seulement pour les backends
  479. personnalisés)
  480. </entry>
  481. </row>
  482. <row>
  483. <entry><emphasis>fast_backend_autoload</emphasis></entry>
  484. <entry><type>Boolean</type></entry>
  485. <entry><constant>FALSE</constant></entry>
  486. <entry>
  487. si <constant>TRUE</constant>, il n'y aura pas de require_once pour le
  488. "fast_backend" (utile seulement pour les backends
  489. personnalisés)
  490. </entry>
  491. </row>
  492. <row>
  493. <entry><emphasis>auto_refresh_fast_cache</emphasis></entry>
  494. <entry><type>Boolean</type></entry>
  495. <entry><constant>TRUE</constant></entry>
  496. <entry>
  497. si <constant>TRUE</constant>, rafraîchissement automatique du cache
  498. rapide quand un enregistrement est appelé
  499. </entry>
  500. </row>
  501. <row>
  502. <entry><emphasis>stats_update_factor</emphasis></entry>
  503. <entry><type>Integer</type></entry>
  504. <entry>10</entry>
  505. <entry>
  506. désactive&#160;/&#160;personnalise le calcul du pourcentage de
  507. remplissage du backend rapide (lors d'une sauvegarde d'un enregistrement
  508. dans le cache, le calcul du remplissage est effectué aléatoirement
  509. 1 fois sur x écritures de cache)
  510. </entry>
  511. </row>
  512. </tbody>
  513. </tgroup>
  514. </table>
  515. </sect2>
  516. <sect2 id="zend.cache.backends.zendserver">
  517. <title> Zend_Cache_Backend_ZendServer_Disk et Zend_Cache_Backend_ZendServer_ShMem </title>
  518. <para>
  519. Ces backends utilisent les fonctionnalités de mise en cache de
  520. <ulink url="http://www.zend.com/en/products/server/downloads-all?zfs=zf_download">Zend
  521. Server</ulink>pour stocker les données.
  522. </para>
  523. <para>
  524. Attention : avec ces backends ne supportent pas les balises ("tags") pour le
  525. moment de même que l'argument "doNotTestCacheValidity=true".
  526. </para>
  527. <para>
  528. Ces backends fonctionnent seulement dans l'environnement de Zend Server pour les
  529. pages requêtées à travers <acronym>HTTP</acronym> ou <acronym>HTTPS</acronym> et ne
  530. fonctionnent pas pour les scripts exécutés en ligne de commande.
  531. </para>
  532. <para>
  533. Spécifiez ce backend en utilisant le paramètre <emphasis>customBackendNaming</emphasis>
  534. à <constant>TRUE</constant> quand vous utilisez la méthode
  535. <methodname>Zend_Cache::factory()</methodname>&#160;:
  536. </para>
  537. <programlisting language="php"><![CDATA[
  538. $cache = Zend_Cache::factory('Core', 'Zend_Cache_Backend_ZendServer_Disk',
  539. $frontendOptions, $backendOptions, false, true);
  540. ]]></programlisting>
  541. <para>Il n'y a pas d'options pour ce backend.</para>
  542. </sect2>
  543. <sect2 id="zend.cache.backends.static">
  544. <title>Zend_Cache_Backend_Static</title>
  545. <para>
  546. This backend works in concert with <classname>Zend_Cache_Frontend_Capture</classname>
  547. (the two must be used together) to save the output from requests as static files. This
  548. means the static files are served directly on subsequent requests without any
  549. involvement of <acronym>PHP</acronym> or Zend Framework at all.
  550. </para>
  551. <note>
  552. <para>
  553. <classname>Zend_Cache_Frontend_Capture</classname> operates
  554. by registering a callback function to be called
  555. when the output buffering it uses is cleaned. In order for this to operate
  556. correctly, it must be the final output buffer in the request. To guarantee
  557. this, the output buffering used by the Dispatcher <emphasis>must</emphasis> be
  558. disabled by calling <classname>Zend_Controller_Front</classname>'s
  559. <methodname>setParam()</methodname> method, for example,
  560. <command>$front->setParam('disableOutputBuffering', true);</command> or adding
  561. "resources.frontcontroller.params.disableOutputBuffering = true"
  562. to your bootstrap configuration file (assumed <acronym>INI</acronym>) if using
  563. <classname>Zend_Application</classname>.
  564. </para>
  565. </note>
  566. <para>
  567. The benefits of this cache include a large throughput increase since
  568. all subsequent requests return the static file and don't need any
  569. dynamic processing. Of course this also has some disadvantages. The
  570. only way to retry the dynamic request is to purge the cached file
  571. from elsewhere in the application (or via a cronjob if timed). It
  572. is also restricted to single-server applications where only one
  573. filesystem is used. Nevertheless, it can be a powerful means of
  574. getting more performance without incurring the cost of a proxy on
  575. single machines.
  576. </para>
  577. <para>
  578. Before describing its options, you should note this needs some
  579. changes to the default <filename>.htaccess</filename> file in order for requests to be
  580. directed to the static files if they exist. Here's an example of
  581. a simple application caching some content, including two specific
  582. feeds which need additional treatment to serve a correct
  583. Content-Type header:
  584. </para>
  585. <programlisting language="text"><![CDATA[
  586. AddType application/rss+xml .xml
  587. AddType application/atom+xml .xml
  588. RewriteEngine On
  589. RewriteCond %{REQUEST_URI} feed/rss$
  590. RewriteCond %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}.xml -f
  591. RewriteRule .* cached/%{REQUEST_URI}.xml [L,T=application/rss+xml]
  592. RewriteCond %{REQUEST_URI} feed/atom$
  593. RewriteCond %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}.xml -f
  594. RewriteRule .* cached/%{REQUEST_URI}.xml [L,T=application/atom+xml]
  595. RewriteCond %{DOCUMENT_ROOT}/cached/index.html -f
  596. RewriteRule ^/*$ cached/index.html [L]
  597. RewriteCond %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}.(html|xml|json|opml|svg) -f
  598. RewriteRule .* cached/%{REQUEST_URI}.%1 [L]
  599. RewriteCond %{REQUEST_FILENAME} -s [OR]
  600. RewriteCond %{REQUEST_FILENAME} -l [OR]
  601. RewriteCond %{REQUEST_FILENAME} -d
  602. RewriteRule ^.*$ - [NC,L]
  603. RewriteRule ^.*$ index.php [NC,L]
  604. ]]></programlisting>
  605. <para>
  606. The above assumes static files are cached to the directory
  607. <filename>./public/cached</filename>. We'll cover the option setting this location,
  608. "public_dir", below.
  609. </para>
  610. <para>
  611. Due to the nature of static file caching, the backend class offers two additional
  612. methods: <methodname>remove()</methodname> and
  613. <methodname>removeRecursively()</methodname>. Both accept a request
  614. <acronym>URI</acronym>, which when mapped to the "public_dir" where static files are
  615. cached, and has a pre-stored extension appended, provides the name of either a static
  616. file to delete, or a directory path to delete recursively. Due to the
  617. restraints of <classname>Zend_Cache_Backend_Interface</classname>, all
  618. other methods such as <methodname>save()</methodname> accept an ID which
  619. is calculated by applying <methodname>bin2hex()</methodname> to a request
  620. <acronym>URI</acronym>.
  621. </para>
  622. <para>
  623. Given the level at which static caching operates, static file caching is addressed for
  624. simpler use with the <classname>Zend_Controller_Action_Helper_Cache</classname> action
  625. helper. This helper assists in setting which actions of a controller to cache, with what
  626. tags, and with which extension. It also offers methods for purging the cache by request
  627. <acronym>URI</acronym> or tag. Static file caching is also assisted by
  628. <classname>Zend_Cache_Manager</classname> which includes pre-configured configuration
  629. templates for a static cache (as <constant>Zend_Cache_Manager::PAGECACHE</constant> or
  630. "page"). The defaults therein can be configured as needed to set up a "public_dir"
  631. location for caching, etc.
  632. </para>
  633. <note>
  634. <para>
  635. It should be noted that the static cache actually uses a secondary cache to store
  636. tags (obviously we can't store them elsewhere since a static cache does not invoke
  637. <acronym>PHP</acronym> if working correctly). This is just a standard Core cache,
  638. and should use a persistent backend such as File or TwoLevels (to take advantage of
  639. memory storage without sacrificing permanent persistance). The backend includes the
  640. option "tag_cache" to set this up (it is obligatory), or the
  641. <methodname>setInnerCache()</methodname> method.
  642. </para>
  643. </note>
  644. <table id="zend.cache.backends.static.table">
  645. <title>Static Backend Options</title>
  646. <tgroup cols="4">
  647. <thead>
  648. <row>
  649. <entry>Option</entry>
  650. <entry>Data Type</entry>
  651. <entry>Default Value</entry>
  652. <entry>Description</entry>
  653. </row>
  654. </thead>
  655. <tbody>
  656. <row>
  657. <entry><emphasis>public_dir</emphasis></entry>
  658. <entry><type>String</type></entry>
  659. <entry><constant>NULL</constant></entry>
  660. <entry>
  661. Directory where to store static files. This must exist
  662. in your public directory.
  663. </entry>
  664. </row>
  665. <row>
  666. <entry><emphasis>file_locking</emphasis></entry>
  667. <entry><type>Boolean</type></entry>
  668. <entry><constant>TRUE</constant></entry>
  669. <entry>
  670. Enable or disable file_locking : Can avoid cache corruption under
  671. bad circumstances but it doesn't help on multithread webservers
  672. or on <acronym>NFS</acronym> filesystems...
  673. </entry>
  674. </row>
  675. <row>
  676. <entry><emphasis>read_control</emphasis></entry>
  677. <entry><type>Boolean</type></entry>
  678. <entry><constant>TRUE</constant></entry>
  679. <entry>
  680. Enable / disable read control : if enabled, a control key is
  681. embedded in the cache file and this key is compared with the
  682. one calculated after the reading.
  683. </entry>
  684. </row>
  685. <row>
  686. <entry><emphasis>read_control_type</emphasis></entry>
  687. <entry><type>String</type></entry>
  688. <entry>'crc32'</entry>
  689. <entry>
  690. Type of read control (only if read control is enabled). Available values
  691. are : 'md5' (best but slowest), 'crc32' (lightly less safe but faster,
  692. better choice), 'adler32' (new choice, faster than crc32),
  693. 'strlen' for a length only test (fastest).
  694. </entry>
  695. </row>
  696. <row>
  697. <entry><emphasis>cache_file_umask</emphasis></entry>
  698. <entry><type>Integer</type></entry>
  699. <entry>0600</entry>
  700. <entry>umask for cached files.</entry>
  701. </row>
  702. <row>
  703. <entry><emphasis>cache_directory_umask</emphasis></entry>
  704. <entry><type>Integer</type></entry>
  705. <entry>0700</entry>
  706. <entry>Umask for directories created within public_dir.</entry>
  707. </row>
  708. <row>
  709. <entry><emphasis>file_extension</emphasis></entry>
  710. <entry><type>String</type></entry>
  711. <entry>'<filename>.html</filename>'</entry>
  712. <entry>
  713. Default file extension for static files created. This can be
  714. configured on the fly, see
  715. <methodname>Zend_Cache_Backend_Static::save()</methodname> though
  716. generally it's recommended to rely on
  717. <classname>Zend_Controller_Action_Helper_Cache</classname> when
  718. doing so since it's simpler that way than messing with
  719. arrays or serialization manually.
  720. </entry>
  721. </row>
  722. <row>
  723. <entry><emphasis>index_filename</emphasis></entry>
  724. <entry><type>String</type></entry>
  725. <entry>'index'</entry>
  726. <entry>
  727. If a request <acronym>URI</acronym> does not contain sufficient
  728. information to construct a static file (usually this means an index
  729. call, e.g. <acronym>URI</acronym> of '/'), the index_filename is used
  730. instead. So '' or '/' would map to '<filename>index.html</filename>'
  731. (assuming the default file_extension is '<filename>.html</filename>').
  732. </entry>
  733. </row>
  734. <row>
  735. <entry><emphasis>tag_cache</emphasis></entry>
  736. <entry><type>Object</type></entry>
  737. <entry><constant>NULL</constant></entry>
  738. <entry>
  739. Used to set an 'inner' cache utilised to store tags
  740. and file extensions associated with static files. This
  741. <emphasis>must</emphasis> be set or the static cache cannot be tracked
  742. and managed.
  743. </entry>
  744. </row>
  745. <row>
  746. <entry><emphasis>disable_caching</emphasis></entry>
  747. <entry><type>Boolean</type></entry>
  748. <entry><constant>FALSE</constant></entry>
  749. <entry>
  750. If set to <constant>TRUE</constant>, static files will not be cached.
  751. This will force all requests to be dynamic even if marked
  752. to be cached in Controllers. Useful for debugging.
  753. </entry>
  754. </row>
  755. </tbody>
  756. </tgroup>
  757. </table>
  758. </sect2>
  759. </sect1>