Zend_Cache-Backends.xml 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <!-- EN-Revision: 24677 -->
  4. <sect1 id="zend.cache.backends">
  5. <title><classname>Zend_Cache</classname> のバックエンド</title>
  6. <para>
  7. バックエンドには、標準と拡張の 2 種類があります。
  8. もちろん、拡張バックエンドのほうがより高機能となります。
  9. </para>
  10. <sect2 id="zend.cache.backends.file">
  11. <title>Zend_Cache_Backend_File</title>
  12. <para>
  13. この (拡張) バックエンドは、キャッシュレコードを
  14. (指定したディレクトリの) ファイルに保存します。
  15. </para>
  16. <para>
  17. 使用可能なオプションは次のとおりです。
  18. </para>
  19. <table id="zend.cache.backends.file.table">
  20. <title>File バックエンドのオプション</title>
  21. <tgroup cols="4">
  22. <thead>
  23. <row>
  24. <entry>オプション</entry>
  25. <entry>データ型</entry>
  26. <entry>デフォルト値</entry>
  27. <entry>説明</entry>
  28. </row>
  29. </thead>
  30. <tbody>
  31. <row>
  32. <entry><emphasis>cache_dir</emphasis></entry>
  33. <entry><type>String</type></entry>
  34. <entry>[system temp dir]</entry>
  35. <entry>
  36. キャッシュファイルを書き込むディレクトリ。
  37. </entry>
  38. </row>
  39. <row>
  40. <entry><emphasis>file_locking</emphasis></entry>
  41. <entry><type>Boolean</type></entry>
  42. <entry><constant>TRUE</constant></entry>
  43. <entry>
  44. ファイルロックを有効/無効にします。
  45. 不慮の事故でキャッシュが破壊されることを防げますが、
  46. マルチスレッドなウェブサーバ環境や <acronym>NFS</acronym> ファイルシステム上では役に立ちません。
  47. </entry>
  48. </row>
  49. <row>
  50. <entry><emphasis>read_control</emphasis></entry>
  51. <entry><type>Boolean</type></entry>
  52. <entry><constant>TRUE</constant></entry>
  53. <entry>
  54. 読み込み制御を有効/無効にします。有効にすると
  55. キャッシュファイルに制御キーが埋め込まれます。
  56. キャッシュの読み込み後、計算した結果とキャッシュのキーを比較します。
  57. </entry>
  58. </row>
  59. <row>
  60. <entry><emphasis>read_control_type</emphasis></entry>
  61. <entry><type>String</type></entry>
  62. <entry>'crc32'</entry>
  63. <entry>
  64. 読み込み制御の方式 (読み込み制御が有効な場合にのみ使用します)。
  65. 使用可能な値は
  66. 'md5' (一番安全だが、最も遅い)、
  67. 'crc32' (安全性には劣るが、より高速。悪くない選択肢です)、
  68. 'adler32' (新たな選択肢。crc32 より高速です)、
  69. 'strlen' (最も高速。長さのみをチェックします)
  70. のいずれかです。
  71. </entry>
  72. </row>
  73. <row>
  74. <entry><emphasis>hashed_directory_level</emphasis></entry>
  75. <entry><type>Integer</type></entry>
  76. <entry>0</entry>
  77. <entry>
  78. ディレクトリ構造のレベルを指定します。0 は "ディレクトリ階層を作らない"、
  79. 1 は "一段階のサブディレクトリを作る"、2 は "二段階の……" を意味します。
  80. 何千ものキャッシュファイルを使用する場合にのみ、
  81. このオプションによる高速化を実感できるでしょう。
  82. 適切な設定値を決めるには、実際にベンチマークを取得するしかありません。
  83. たいていの場合は 1 または 2 でよいでしょう。
  84. </entry>
  85. </row>
  86. <row>
  87. <entry><emphasis>hashed_directory_perm</emphasis></entry>
  88. <entry><type>Integer</type></entry>
  89. <entry>0700</entry>
  90. <entry>
  91. ディレクトリ構造に対する権限を指定します。
  92. </entry>
  93. </row>
  94. <row>
  95. <entry><emphasis>file_name_prefix</emphasis></entry>
  96. <entry><type>String</type></entry>
  97. <entry>'zend_cache'</entry>
  98. <entry>
  99. キャッシュファイルのプレフィックスを設定します。
  100. このオプションを設定する際には十分注意しましょう。
  101. あまりにもありふれた値をシステムのキャッシュディレクトリ
  102. (<filename>/tmp</filename> など) で使用すると、
  103. キャッシュの削除の際に余計なものまで削除されてしまうはめになります。
  104. </entry>
  105. </row>
  106. <row>
  107. <entry><emphasis>cache_file_umask</emphasis></entry>
  108. <entry><type>Integer</type></entry>
  109. <entry>0600</entry>
  110. <entry>
  111. キャッシュファイルの umask を設定します。
  112. </entry>
  113. </row>
  114. <row>
  115. <entry><emphasis>cache_file_perm</emphasis></entry>
  116. <entry><type>Integer</type></entry>
  117. <entry>0600</entry>
  118. <entry>キャッシュファイルに対する権限を指定します。</entry>
  119. </row>
  120. <row>
  121. <entry><emphasis>metatadatas_array_max_size</emphasis></entry>
  122. <entry><type>Integer</type></entry>
  123. <entry>100</entry>
  124. <entry>
  125. メタデータ配列の内部最大サイズを設定します
  126. (よくわからない場合はこの値を変更してはいけません)。
  127. </entry>
  128. </row>
  129. </tbody>
  130. </tgroup>
  131. </table>
  132. </sect2>
  133. <sect2 id="zend.cache.backends.sqlite">
  134. <title>Zend_Cache_Backend_Sqlite</title>
  135. <para>
  136. この (拡張) バックエンドは、キャッシュレコードを
  137. SQLite データベースに保存します。
  138. </para>
  139. <para>
  140. 使用可能なオプションは次のとおりです。
  141. </para>
  142. <table id="zend.cache.backends.sqlite.table">
  143. <title>Sqlite バックエンドのオプション</title>
  144. <tgroup cols="4">
  145. <thead>
  146. <row>
  147. <entry>オプション</entry>
  148. <entry>データ型</entry>
  149. <entry>デフォルト値</entry>
  150. <entry>説明</entry>
  151. </row>
  152. </thead>
  153. <tbody>
  154. <row>
  155. <entry><emphasis>cache_db_complete_path (必須)</emphasis></entry>
  156. <entry><type>String</type></entry>
  157. <entry><constant>NULL</constant></entry>
  158. <entry>
  159. SQLite データベースへの (ファイル名も含めた) フルパス。
  160. </entry>
  161. </row>
  162. <row>
  163. <entry><emphasis>automatic_vacuum_factor</emphasis></entry>
  164. <entry><type>Integer</type></entry>
  165. <entry>10</entry>
  166. <entry>
  167. 自動バキューム処理の設定を行います。
  168. 自動バキューム処理とは、<methodname>clean()</methodname> や <methodname>delete()</methodname>
  169. がコールされた際に自動的にデータベースの断片化解消を行う
  170. (そしてサイズを縮小する) ことです。
  171. 0 を指定すると、自動バキュームを行いません。
  172. 1 を指定すると (<methodname>delete()</methodname> や <methodname>clean()</methodname>
  173. がコールされると) そのたびにバキュームを行います。
  174. x (1 より大きな整数) を指定すると、
  175. <methodname>clean()</methodname> や <methodname>delete()</methodname> が x 回コールされるたびに
  176. 一回の頻度でランダムに自動バキュームを行います。
  177. </entry>
  178. </row>
  179. </tbody>
  180. </tgroup>
  181. </table>
  182. </sect2>
  183. <sect2 id="zend.cache.backends.memcached">
  184. <title>Zend_Cache_Backend_Memcached</title>
  185. <para>
  186. この (拡張) バックエンドは、キャッシュレコードを memcached サーバに保存します。
  187. <ulink url="http://www.danga.com/memcached/">memcached</ulink> は、
  188. 高性能な分散メモリオブジェクトキャッシュシステムです。このバックエンドを使用するには、
  189. memcached デーモンおよび
  190. <ulink url="http://pecl.php.net/package/memcache">memcache <acronym>PECL</acronym> 拡張モジュール</ulink>
  191. が必要です。
  192. </para>
  193. <para>
  194. 注意: このバックエンドでは、今のところ "タグ" がサポートされていません。
  195. また、引数 "doNotTestCacheValidity=true" もサポートされていません。
  196. </para>
  197. <para>
  198. 使用可能なオプションは次のとおりです。
  199. </para>
  200. <table id="zend.cache.backends.memcached.table">
  201. <title>Memcached バックエンドのオプション</title>
  202. <tgroup cols="4">
  203. <thead>
  204. <row>
  205. <entry>オプション</entry>
  206. <entry>データ型</entry>
  207. <entry>デフォルト値</entry>
  208. <entry>説明</entry>
  209. </row>
  210. </thead>
  211. <tbody>
  212. <row>
  213. <entry><emphasis>servers</emphasis></entry>
  214. <entry><type>Array</type></entry>
  215. <entry>
  216. <command>array(array('host' => 'localhost', 'port' => 11211,
  217. 'persistent' => true, 'weight' => 1, 'timeout' => 5,
  218. 'retry_interval' => 15, 'status' => true,
  219. 'failure_callback' => '' ))</command>
  220. </entry>
  221. <entry>
  222. memcached サーバの配列です。各 memcached サーバの情報は、
  223. 以下のような連想配列で指定します。
  224. 'host' => (string) : memcached サーバのサーバ名
  225. 'port' => (int) : memcached サーバのポート番号
  226. 'persistent' => (bool) : この memcached サーバに対して持続的な接続を使用するかどうか
  227. 'weight' => (int) : memcached サーバの重み付け
  228. 'timeout' => (int) : memcached サーバのタイムアウト
  229. 'retry_interval' => (int) : memcached サーバの再試行間隔
  230. 'status' => (bool) : memcached サーバのステータス
  231. 'failure_callback' => (callback) : memcached サーバのコールバック関数
  232. </entry>
  233. </row>
  234. <row>
  235. <entry><emphasis>compression</emphasis></entry>
  236. <entry><type>Boolean</type></entry>
  237. <entry><constant>FALSE</constant></entry>
  238. <entry>
  239. その場での圧縮処理を行いたい場合に <constant>TRUE</constant> を指定します。
  240. </entry>
  241. </row>
  242. <row>
  243. <entry><emphasis>compatibility</emphasis></entry>
  244. <entry><type>Boolean</type></entry>
  245. <entry><constant>FALSE</constant></entry>
  246. <entry>
  247. 古い memcache サーバ/拡張モジュールとの互換性モードを使用したい場合に
  248. <constant>TRUE</constant> を指定します。
  249. </entry>
  250. </row>
  251. </tbody>
  252. </tgroup>
  253. </table>
  254. </sect2>
  255. <!-- TODO : to be translated -->
  256. <sect2 id="zend.cache.backends.libmemcached">
  257. <title>Zend_Cache_Backend_Libmemcached</title>
  258. <para>
  259. This (extended) backend stores cache records into a memcached server. <ulink
  260. url="http://www.danga.com/memcached/">memcached</ulink> is a high-performance,
  261. distributed memory object caching system. To use this backend, you need a memcached
  262. daemon and <ulink url="http://pecl.php.net/package/memcached">the memcached
  263. <acronym>PECL</acronym> extension</ulink>.
  264. </para>
  265. <para>
  266. Be careful : with this backend, "tags" are not supported for the moment as
  267. the "doNotTestCacheValidity=true" argument.
  268. </para>
  269. <para>
  270. Available options are :
  271. </para>
  272. <table id="zend.cache.backends.libmemcached.table">
  273. <title>Libmemcached Backend Options</title>
  274. <tgroup cols="4">
  275. <thead>
  276. <row>
  277. <entry>Option</entry>
  278. <entry>Data Type</entry>
  279. <entry>Default Value</entry>
  280. <entry>Description</entry>
  281. </row>
  282. </thead>
  283. <tbody>
  284. <row>
  285. <entry><emphasis>servers</emphasis></entry>
  286. <entry><type>Array</type></entry>
  287. <entry>
  288. <command>array(array('host' => 'localhost', 'port' => 11211,
  289. 'weight' => 1))</command>
  290. </entry>
  291. <entry>
  292. An array of memcached servers ; each memcached server is described by
  293. an associative array:
  294. 'host' => (string) : the name of the memcached server,
  295. 'port' => (int) : the port of the memcached server,
  296. 'weight' => (int) :the weight of the memcached server
  297. </entry>
  298. </row>
  299. <row>
  300. <entry><emphasis>client</emphasis></entry>
  301. <entry><type>Array</type></entry>
  302. <entry>
  303. <command>array(
  304. Memcached::OPT_DISTRIBUTION => Memcached::DISTRIBUTION_CONSISTENT,
  305. Memcached::OPT_HASH => Memcached::HASH_MD5,
  306. Memcached::OPT_LIBKETAMA_COMPATIBLE => true
  307. )</command>
  308. </entry>
  309. <entry>
  310. An associative array of memcached client options ;
  311. The array key can be the name of the memcached option constant
  312. (without 'OPT_') or the integer value of it.
  313. See <ulink url="http://php.net/manual/memcached.constants.php">
  314. Memcached constants on <acronym>PHP</acronym> manual</ulink>
  315. </entry>
  316. </row>
  317. </tbody>
  318. </tgroup>
  319. </table>
  320. </sect2>
  321. <sect2 id="zend.cache.backends.apc">
  322. <title>Zend_Cache_Backend_Apc</title>
  323. <para>
  324. この (拡張) バックエンドは、キャッシュレコードを共有メモリに保存する際に
  325. <ulink url="http://pecl.php.net/package/APC">APC</ulink> (Alternative <acronym>PHP</acronym> Cache)
  326. 拡張モジュールを使用します
  327. (当然、このバックエンドを使用するにはこの拡張モジュールが必要です)。
  328. </para>
  329. <para>
  330. 注意: このバックエンドでは、今のところ "タグ" がサポートされていません。
  331. また、引数 "doNotTestCacheValidity=true" もサポートされていません。
  332. </para>
  333. <para>
  334. このバックエンドではオプションを使用しません。
  335. </para>
  336. </sect2>
  337. <sect2 id="zend.cache.backends.xcache">
  338. <title>Zend_Cache_Backend_Xcache</title>
  339. <para>
  340. このバックエンドは、キャッシュレコードを共有メモリに保存する際に
  341. <ulink url="http://xcache.lighttpd.net/">XCache</ulink>
  342. 拡張モジュールを使用します
  343. (当然、このバックエンドを使うにはこの拡張モジュールが必要となります)。
  344. </para>
  345. <para>
  346. 注意: このバックエンドでは、今のところ "タグ" がサポートされていません。
  347. また、引数 "doNotTestCacheValidity=true" もサポートされていません。
  348. </para>
  349. <para>
  350. 使用可能なオプションは次のとおりです。
  351. </para>
  352. <table id="zend.cache.backends.xcache.table">
  353. <title>Xcache バックエンドのオプション</title>
  354. <tgroup cols="4">
  355. <thead>
  356. <row>
  357. <entry>オプション</entry>
  358. <entry>データ型</entry>
  359. <entry>デフォルト値</entry>
  360. <entry>説明</entry>
  361. </row>
  362. </thead>
  363. <tbody>
  364. <row>
  365. <entry><emphasis>user</emphasis></entry>
  366. <entry><type>String</type></entry>
  367. <entry><constant>NULL</constant></entry>
  368. <entry>
  369. <filename>xcache.admin.user</filename> です。
  370. <methodname>clean()</methodname> メソッドを使う際に必要です。
  371. </entry>
  372. </row>
  373. <row>
  374. <entry><emphasis>password</emphasis></entry>
  375. <entry><type>String</type></entry>
  376. <entry><constant>NULL</constant></entry>
  377. <entry>
  378. <filename>xcache.admin.pass</filename> (<acronym>MD5</acronym> ではない平文形式) です。
  379. <methodname>clean()</methodname> メソッドを使う際に必要です。
  380. </entry>
  381. </row>
  382. </tbody>
  383. </tgroup>
  384. </table>
  385. </sect2>
  386. <sect2 id="zend.cache.backends.platform">
  387. <title>Zend_Cache_Backend_ZendPlatform</title>
  388. <para>
  389. このバックエンドは、<ulink url="http://www.zend.co.jp/product/zendplatform.html">Zend Platform</ulink>
  390. 製品のコンテンツキャッシング <acronym>API</acronym> を使用します。当然、このバックエンドを使用するには
  391. Zend Platform をインストールする必要があります。
  392. </para>
  393. <para>
  394. このバックエンドはタグをサポートしています。しかし、
  395. クリーニングモード <constant>CLEANING_MODE_NOT_MATCHING_TAG</constant> はサポートしていません。
  396. </para>
  397. <para>
  398. <methodname>Zend_Cache::factory()</methodname> メソッドでこのバックエンドを指定する場合は、
  399. 'Zend' と 'Platform' の間に区切り文字を入れます。区切り文字としては
  400. '-'、'.'、' ' あるいは '_' が使用できます。
  401. </para>
  402. <programlisting language="php"><![CDATA[
  403. $cache = Zend_Cache::factory('Core', 'Zend Platform');
  404. ]]></programlisting>
  405. <para>
  406. このバックエンドではオプションを使用しません。
  407. </para>
  408. </sect2>
  409. <sect2 id="zend.cache.backends.twolevels">
  410. <title>Zend_Cache_Backend_TwoLevels</title>
  411. <para>
  412. この (拡張) バックエンドは複合型です。
  413. キャッシュレコードを、
  414. 高速 (だが制限付き) な Apc、Memcache…… および "低速"
  415. な File、Sqlite…… の 2 種類の別々のバックエンドに格納します。
  416. </para>
  417. <para>
  418. このバックエンドは priority パラメータを使用 (フロントエンドレベルで、記録開始時に指定)
  419. し、高速バックエンドの残りのスペースを用いてふたつのバックエンドの使用を最適化します。
  420. </para>
  421. <para>
  422. <methodname>Zend_Cache::factory()</methodname> メソッドでこのバックエンドを指定する場合は、
  423. 'Two' と 'Levels' の間に区切り文字を入れます。区切り文字としては
  424. '-'、'.'、' ' あるいは '_' が使用できます。
  425. </para>
  426. <programlisting language="php"><![CDATA[
  427. $cache = Zend_Cache::factory('Core', 'Two Levels');
  428. ]]></programlisting>
  429. <para>
  430. 使用可能なオプションは次のとおりです。
  431. </para>
  432. <table id="zend.cache.backends.twolevels.table">
  433. <title>TwoLevels バックエンドのオプション</title>
  434. <tgroup cols="4">
  435. <thead>
  436. <row>
  437. <entry>オプション</entry>
  438. <entry>データ型</entry>
  439. <entry>デフォルト値</entry>
  440. <entry>説明</entry>
  441. </row>
  442. </thead>
  443. <tbody>
  444. <row>
  445. <entry><emphasis>slow_backend</emphasis></entry>
  446. <entry><type>String</type></entry>
  447. <entry>File</entry>
  448. <entry>
  449. "低速" バックエンドの名前。
  450. </entry>
  451. </row>
  452. <row>
  453. <entry><emphasis>fast_backend</emphasis></entry>
  454. <entry><type>String</type></entry>
  455. <entry>Apc</entry>
  456. <entry>
  457. "高速" バックエンドの名前。
  458. </entry>
  459. </row>
  460. <row>
  461. <entry><emphasis>slow_backend_options</emphasis></entry>
  462. <entry><type>Array</type></entry>
  463. <entry><methodname>array()</methodname></entry>
  464. <entry>
  465. "低速" バックエンドのオプション。
  466. </entry>
  467. </row>
  468. <row>
  469. <entry><emphasis>fast_backend_options</emphasis></entry>
  470. <entry><type>Array</type></entry>
  471. <entry><methodname>array()</methodname></entry>
  472. <entry>
  473. "高速" バックエンドのオプション。
  474. </entry>
  475. </row>
  476. <row>
  477. <entry><emphasis>slow_backend_custom_naming</emphasis></entry>
  478. <entry><type>Boolean</type></entry>
  479. <entry><constant>FALSE</constant></entry>
  480. <entry>
  481. <constant>TRUE</constant> の場合は、引数 slow_backend を完全なクラス名として使用します。
  482. <constant>FALSE</constant> の場合は、引数をクラス名 "<classname>Zend_Cache_Backend_</classname>[...]"
  483. の最後の部分として使用します。
  484. </entry>
  485. </row>
  486. <row>
  487. <entry><emphasis>fast_backend_custom_naming</emphasis></entry>
  488. <entry><type>Boolean</type></entry>
  489. <entry><constant>FALSE</constant></entry>
  490. <entry>
  491. <constant>TRUE</constant> の場合は、引数 fast_backend を完全なクラス名として使用します。
  492. <constant>FALSE</constant> の場合は、引数をクラス名 "<classname>Zend_Cache_Backend_</classname>[...]"
  493. の最後の部分として使用します。
  494. </entry>
  495. </row>
  496. <row>
  497. <entry><emphasis>slow_backend_autoload</emphasis></entry>
  498. <entry><type>Boolean</type></entry>
  499. <entry><constant>FALSE</constant></entry>
  500. <entry>
  501. <constant>TRUE</constant> の場合は、低速バックエンドに対して require_once を行いません
  502. (独自のバックエンドを使用する場合にのみ有用です)。
  503. </entry>
  504. </row>
  505. <row>
  506. <entry><emphasis>fast_backend_autoload</emphasis></entry>
  507. <entry><type>Boolean</type></entry>
  508. <entry><constant>FALSE</constant></entry>
  509. <entry>
  510. <constant>TRUE</constant> の場合は、高速バックエンドに対して require_once を行いません
  511. (独自のバックエンドを使用する場合にのみ有用です)。
  512. </entry>
  513. </row>
  514. <row>
  515. <entry><emphasis>auto_refresh_fast_cache</emphasis></entry>
  516. <entry><type>Boolean</type></entry>
  517. <entry><constant>TRUE</constant></entry>
  518. <entry>
  519. <constant>TRUE</constant> の場合は、キャッシュレコードにヒットしたときに
  520. 高速キャッシュを自動的にリフレッシュします。
  521. </entry>
  522. </row>
  523. <row>
  524. <entry><emphasis>stats_update_factor</emphasis></entry>
  525. <entry><type>Integer</type></entry>
  526. <entry>10</entry>
  527. <entry>
  528. 高速バックエンドを使用率の計算を無効化 / 効率化します
  529. (レコードをキャッシュに書き込む際の
  530. 高速バックエンド使用率の計算は、
  531. キャッシュ書き込み x 回につき 1 回の割合でランダムに行われます)。
  532. </entry>
  533. </row>
  534. </tbody>
  535. </tgroup>
  536. </table>
  537. </sect2>
  538. <sect2 id="zend.cache.backends.zendserver">
  539. <title>Zend_Cache_Backend_ZendServer_Disk および Zend_Cache_Backend_ZendServer_ShMem</title>
  540. <para>
  541. これらのバックエンドは、キャッシュレコードの保存に
  542. <ulink url="http://www.zend.co.jp/product/zendserver.html">Zend Server</ulink>
  543. のキャッシュ機能を使用します。
  544. </para>
  545. <para>
  546. 注意: このバックエンドでは、今のところ "タグ" がサポートされていません。
  547. また、引数 "doNotTestCacheValidity=true" もサポートされていません。
  548. </para>
  549. <para>
  550. これらのバックエンドが動作するのは、Zend Server 環境で
  551. <acronym>HTTP</acronym> あるいは <acronym>HTTPS</acronym>
  552. 越しにページをリクエストした場合のみです。
  553. コマンドラインでスクリプトを実行した場合は動作しません。
  554. </para>
  555. <para>
  556. <methodname>Zend_Cache::factory()</methodname> メソッドでこのバックエンドを指定する場合は、
  557. パラメータ <emphasis>customBackendNaming</emphasis> を <constant>TRUE</constant> とします。
  558. </para>
  559. <programlisting language="php"><![CDATA[
  560. $cache = Zend_Cache::factory('Core', 'Zend_Cache_Backend_ZendServer_Disk',
  561. $frontendOptions, $backendOptions, false, true);
  562. ]]></programlisting>
  563. <para>
  564. このバックエンドにはオプションはありません。
  565. </para>
  566. </sect2>
  567. <!-- TODO : to be translated -->
  568. <sect2 id="zend.cache.backends.static">
  569. <title>Zend_Cache_Backend_Static</title>
  570. <para>
  571. This backend works in concert with <classname>
  572. Zend_Cache_Frontend_Capture</classname> (the two must be used
  573. together) to save the output from requests as static files. This
  574. means the static files are served directly on subsequent requests
  575. without any involvement of PHP or the Zend Framework at all.
  576. </para>
  577. <note>
  578. <para>
  579. <classname>Zend_Cache_Frontend_Capture</classname> operates
  580. by registering a callback function to be called
  581. when the output buffering it uses is cleaned. In order for this to operate
  582. correctly, it must be the final output buffer in the request. To guarantee
  583. this, the output buffering used by the Dispatcher <emphasis>must</emphasis> be
  584. disabled by calling <classname>Zend_Controller_Front</classname>'s
  585. <methodname>setParam()</methodname> method, for example,
  586. <command>$front->setParam('disableOutputBuffering', true);</command> or adding
  587. "resources.frontcontroller.params.disableOutputBuffering = true"
  588. to your bootstrap configuration file (assumed <acronym>INI</acronym>) if using
  589. <classname>Zend_Application</classname>.
  590. </para>
  591. </note>
  592. <para>
  593. The benefits of this cache include a large throughput increase since
  594. all subsequent requests return the static file and don't need any
  595. dynamic processing. Of course this also has some disadvantages. The
  596. only way to retry the dynamic request is to purge the cached file
  597. from elsewhere in the application (or via a cronjob if timed). It
  598. is also restricted to single-server applications where only one
  599. filesystem is used. Nevertheless, it can be a powerful means of
  600. getting more performance without incurring the cost of a proxy on
  601. single machines.
  602. </para>
  603. <para>
  604. Before describing its options, you should note this needs some
  605. changes to the default .htaccess file in order for requests to be
  606. directed to the static files if they exist. Here's an example of
  607. a simple application caching some content, including two specific
  608. feeds which need additional treatment to serve a correct
  609. Content-Type header:
  610. </para>
  611. <programlisting language="text"><![CDATA[
  612. AddType application/rss+xml .xml
  613. AddType application/atom+xml .xml
  614. RewriteEngine On
  615. RewriteCond %{REQUEST_URI} feed/rss$
  616. RewriteCond %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}.xml -f
  617. RewriteRule .* cached/%{REQUEST_URI}.xml [L,T=application/rss+xml]
  618. RewriteCond %{REQUEST_URI} feed/atom$
  619. RewriteCond %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}.xml -f
  620. RewriteRule .* cached/%{REQUEST_URI}.xml [L,T=application/atom+xml]
  621. RewriteCond %{DOCUMENT_ROOT}/cached/index.html -f
  622. RewriteRule ^/*$ cached/index.html [L]
  623. RewriteCond %{DOCUMENT_ROOT}/cached/%{REQUEST_URI}.(html|xml|json|opml|svg) -f
  624. RewriteRule .* cached/%{REQUEST_URI}.%1 [L]
  625. RewriteCond %{REQUEST_FILENAME} -s [OR]
  626. RewriteCond %{REQUEST_FILENAME} -l [OR]
  627. RewriteCond %{REQUEST_FILENAME} -d
  628. RewriteRule ^.*$ - [NC,L]
  629. RewriteRule ^.*$ index.php [NC,L]
  630. ]]></programlisting>
  631. <para>
  632. The above assumes static files are cached to the directory ./public/cached.
  633. We'll cover the option setting this location, "public_dir", below.
  634. </para>
  635. <para>
  636. Due to the nature of static file caching, the backend class offers two
  637. additional methods: <methodname>remove()</methodname> and <methodname>
  638. removeRecursively()</methodname>. Both accept a request URI, which when
  639. mapped to the "public_dir" where static files are cached, and has a
  640. pre-stored extension appended, provides the name of either a static
  641. file to delete, or a directory path to delete recursively. Due to the
  642. restraints of <classname>Zend_Cache_Backend_Interface</classname>, all
  643. other methods such as <classname>save()</classname> accept an ID which
  644. is calculated by applying bin2hex() to a request URI.
  645. </para>
  646. <para>
  647. Given the level at which static caching operates, static file caching
  648. is addressed for simpler use with the <classname>
  649. Zend_Controller_Action_Helper_Cache</classname> action helper. This helper
  650. assists in setting which actions of a controller to cache, with what tags,
  651. and with which extension. It also offers methods for purging the cache by
  652. request URI or tag. Static file caching is also assisted by <classname>
  653. Zend_Cache_Manager</classname> which includes pre-configured configuration
  654. templates for a static cache (as Zend_Cache_Manager::PAGECACHE or "page").
  655. The defaults therein can be configured as needed to set up a "public_dir"
  656. location for caching, etc.
  657. </para>
  658. <note>
  659. <para>
  660. It should be noted that the static cache actually uses a secondary
  661. cache to store tags (obviously we can't store them elsewhere since
  662. a static cache does not invoke PHP if working correctly). This is
  663. just a standard Core cache, and should use a persistent backend such
  664. as File or TwoLevels (to take advantage of memory storage without
  665. sacrificing permanent persistance). The backend includes the option
  666. "tag_cache" to set this up (it is obligatory), or the <methodname>
  667. setInnerCache()</methodname> method.
  668. </para>
  669. </note>
  670. <table id="zend.cache.backends.static.table">
  671. <title>Static Backend Options</title>
  672. <tgroup cols="4">
  673. <thead>
  674. <row>
  675. <entry>Option</entry>
  676. <entry>Data Type</entry>
  677. <entry>Default Value</entry>
  678. <entry>Description</entry>
  679. </row>
  680. </thead>
  681. <tbody>
  682. <row>
  683. <entry><emphasis>public_dir</emphasis></entry>
  684. <entry><type>String</type></entry>
  685. <entry>NULL</entry>
  686. <entry>
  687. Directory where to store static files. This must exist
  688. in your public directory.
  689. </entry>
  690. </row>
  691. <row>
  692. <entry><emphasis>file_locking</emphasis></entry>
  693. <entry><type>Boolean</type></entry>
  694. <entry><constant>TRUE</constant></entry>
  695. <entry>
  696. Enable or disable file_locking : Can avoid cache corruption under
  697. bad circumstances but it doesn't help on multithread webservers
  698. or on <acronym>NFS</acronym> filesystems...
  699. </entry>
  700. </row>
  701. <row>
  702. <entry><emphasis>read_control</emphasis></entry>
  703. <entry><type>Boolean</type></entry>
  704. <entry><constant>TRUE</constant></entry>
  705. <entry>
  706. Enable / disable read control : if enabled, a control key is
  707. embedded in the cache file and this key is compared with the
  708. one calculated after the reading.
  709. </entry>
  710. </row>
  711. <row>
  712. <entry><emphasis>read_control_type</emphasis></entry>
  713. <entry><type>String</type></entry>
  714. <entry>'crc32'</entry>
  715. <entry>
  716. Type of read control (only if read control is enabled). Available values
  717. are : 'md5' (best but slowest), 'crc32' (lightly less safe but faster,
  718. better choice), 'adler32' (new choice, faster than crc32),
  719. 'strlen' for a length only test (fastest).
  720. </entry>
  721. </row>
  722. <row>
  723. <entry><emphasis>cache_file_umask</emphasis></entry>
  724. <entry><type>Integer</type></entry>
  725. <entry>0600</entry>
  726. <entry>
  727. umask for cached files.
  728. </entry>
  729. </row>
  730. <row>
  731. <entry><emphasis>cache_directory_umask</emphasis></entry>
  732. <entry><type>Integer</type></entry>
  733. <entry>0700</entry>
  734. <entry>
  735. Umask for directories created within public_dir.
  736. </entry>
  737. </row>
  738. <row>
  739. <entry><emphasis>file_extension</emphasis></entry>
  740. <entry><type>String</type></entry>
  741. <entry>'.html'</entry>
  742. <entry>
  743. Default file extension for static files created. This
  744. can be configured on the fly, see <methodname>
  745. Zend_Cache_Backend_Static::save()</methodname> though
  746. generally it's recommended to rely on <classname>
  747. Zend_Controller_Action_Helper_Cache</classname> when
  748. doing so since it's simpler that way than messing with
  749. arrays/serialization manually.
  750. </entry>
  751. </row>
  752. <row>
  753. <entry><emphasis>index_filename</emphasis></entry>
  754. <entry><type>String</type></entry>
  755. <entry>'index'</entry>
  756. <entry>
  757. If a request URI does not contain sufficient information
  758. to construct a static file (usually this means an index
  759. call, e.g. URI of '/'), the index_filename is used instead.
  760. So '' or '/' would map to 'index.html' (assuming the default
  761. file_extension is '.html').
  762. </entry>
  763. </row>
  764. <row>
  765. <entry><emphasis>tag_cache</emphasis></entry>
  766. <entry><type>Object</type></entry>
  767. <entry>NULL</entry>
  768. <entry>
  769. Used to set an 'inner' cache utilised to store tags
  770. and file extensions associated with static files. This
  771. MUST be set or the static cache cannot be tracked and
  772. managed.
  773. </entry>
  774. </row>
  775. <row>
  776. <entry><emphasis>disable_caching</emphasis></entry>
  777. <entry><type>Boolean</type></entry>
  778. <entry>FALSE</entry>
  779. <entry>
  780. If set to TRUE, static files will not be cached. This
  781. will force all requests to be dynamic even if marked
  782. to be cached in Controllers. Useful for debugging.
  783. </entry>
  784. </row>
  785. </tbody>
  786. </tgroup>
  787. </table>
  788. </sect2>
  789. </sect1>
  790. <!--
  791. vim:se ts=4 sw=4 et:
  792. -->