Zend_Cache-Backends.xml 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <!-- EN-Revision: 17749 -->
  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>'<filename>/tmp/</filename>'</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_umask</emphasis></entry>
  88. <entry><type>Integer</type></entry>
  89. <entry>0700</entry>
  90. <entry>
  91. ディレクトリ構造の umask を指定します。
  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>0700</entry>
  110. <entry>
  111. キャッシュファイルの umask を設定します。
  112. </entry>
  113. </row>
  114. <row>
  115. <entry><emphasis>metatadatas_array_max_size</emphasis></entry>
  116. <entry><type>Integer</type></entry>
  117. <entry>100</entry>
  118. <entry>
  119. メタデータ配列の内部最大サイズを設定します
  120. (よくわからない場合はこの値を変更してはいけません)。
  121. </entry>
  122. </row>
  123. </tbody>
  124. </tgroup>
  125. </table>
  126. </sect2>
  127. <sect2 id="zend.cache.backends.sqlite">
  128. <title>Zend_Cache_Backend_Sqlite</title>
  129. <para>
  130. この (拡張) バックエンドは、キャッシュレコードを
  131. SQLite データベースに保存します。
  132. </para>
  133. <para>
  134. 使用可能なオプションは次のとおりです。
  135. </para>
  136. <table id="zend.cache.backends.sqlite.table">
  137. <title>Sqlite バックエンドのオプション</title>
  138. <tgroup cols="4">
  139. <thead>
  140. <row>
  141. <entry>オプション</entry>
  142. <entry>データ型</entry>
  143. <entry>デフォルト値</entry>
  144. <entry>説明</entry>
  145. </row>
  146. </thead>
  147. <tbody>
  148. <row>
  149. <entry><emphasis>cache_db_complete_path (必須)</emphasis></entry>
  150. <entry><type>String</type></entry>
  151. <entry><constant>NULL</constant></entry>
  152. <entry>
  153. SQLite データベースへの (ファイル名も含めた) フルパス。
  154. </entry>
  155. </row>
  156. <row>
  157. <entry><emphasis>automatic_vacuum_factor</emphasis></entry>
  158. <entry><type>Integer</type></entry>
  159. <entry>10</entry>
  160. <entry>
  161. 自動バキューム処理の設定を行います。
  162. 自動バキューム処理とは、<methodname>clean()</methodname> や <methodname>delete()</methodname>
  163. がコールされた際に自動的にデータベースの断片化解消を行う
  164. (そしてサイズを縮小する) ことです。
  165. 0 を指定すると、自動バキュームを行いません。
  166. 1 を指定すると (<methodname>delete()</methodname> や <methodname>clean()</methodname>
  167. がコールされると) そのたびにバキュームを行います。
  168. x (1 より大きな整数) を指定すると、
  169. <methodname>clean()</methodname> や <methodname>delete()</methodname> が x 回コールされるたびに
  170. 一回の頻度でランダムに自動バキュームを行います。
  171. </entry>
  172. </row>
  173. </tbody>
  174. </tgroup>
  175. </table>
  176. </sect2>
  177. <sect2 id="zend.cache.backends.memcached">
  178. <title>Zend_Cache_Backend_Memcached</title>
  179. <para>
  180. この (拡張) バックエンドは、キャッシュレコードを memcached サーバに保存します。
  181. <ulink url="http://www.danga.com/memcached/">memcached</ulink> は、
  182. 高性能な分散メモリオブジェクトキャッシュシステムです。このバックエンドを使用するには、
  183. memcached デーモンおよび
  184. <ulink url="http://pecl.php.net/package/memcache">memcache <acronym>PECL</acronym> 拡張モジュール</ulink>
  185. が必要です。
  186. </para>
  187. <para>
  188. 注意: このバックエンドでは、今のところ "タグ" がサポートされていません。
  189. また、引数 "doNotTestCacheValidity=true" もサポートされていません。
  190. </para>
  191. <para>
  192. 使用可能なオプションは次のとおりです。
  193. </para>
  194. <table id="zend.cache.backends.memcached.table">
  195. <title>Memcached バックエンドのオプション</title>
  196. <tgroup cols="4">
  197. <thead>
  198. <row>
  199. <entry>オプション</entry>
  200. <entry>データ型</entry>
  201. <entry>デフォルト値</entry>
  202. <entry>説明</entry>
  203. </row>
  204. </thead>
  205. <tbody>
  206. <row>
  207. <entry><emphasis>servers</emphasis></entry>
  208. <entry><type>Array</type></entry>
  209. <entry>
  210. <command>array(array('host' => 'localhost', 'port' => 11211,
  211. 'persistent' => true, 'weight' => 1, 'timeout' => 5,
  212. 'retry_interval' => 15, 'status' => true,
  213. 'failure_callback' => '' ))</command>
  214. </entry>
  215. <entry>
  216. memcached サーバの配列です。各 memcached サーバの情報は、
  217. 以下のような連想配列で指定します。
  218. 'host' => (string) : memcached サーバのサーバ名
  219. 'port' => (int) : memcached サーバのポート番号
  220. 'persistent' => (bool) : この memcached サーバに対して持続的な接続を使用するかどうか
  221. 'weight' => (int) : memcached サーバの重み付け
  222. 'timeout' => (int) : memcached サーバのタイムアウト
  223. 'retry_interval' => (int) : memcached サーバの再試行間隔
  224. 'status' => (bool) : memcached サーバのステータス
  225. 'failure_callback' => (callback) : memcached サーバのコールバック関数
  226. </entry>
  227. </row>
  228. <row>
  229. <entry><emphasis>compression</emphasis></entry>
  230. <entry><type>Boolean</type></entry>
  231. <entry><constant>FALSE</constant></entry>
  232. <entry>
  233. その場での圧縮処理を行いたい場合に <constant>TRUE</constant> を指定します。
  234. </entry>
  235. </row>
  236. <row>
  237. <entry><emphasis>compatibility</emphasis></entry>
  238. <entry><type>Boolean</type></entry>
  239. <entry><constant>FALSE</constant></entry>
  240. <entry>
  241. 古い memcache サーバ/拡張モジュールとの互換性モードを使用したい場合に
  242. <constant>TRUE</constant> を指定します。
  243. </entry>
  244. </row>
  245. </tbody>
  246. </tgroup>
  247. </table>
  248. </sect2>
  249. <sect2 id="zend.cache.backends.apc">
  250. <title>Zend_Cache_Backend_Apc</title>
  251. <para>
  252. この (拡張) バックエンドは、キャッシュレコードを共有メモリに保存する際に
  253. <ulink url="http://pecl.php.net/package/APC">APC</ulink> (Alternative <acronym>PHP</acronym> Cache)
  254. 拡張モジュールを使用します
  255. (当然、このバックエンドを使用するにはこの拡張モジュールが必要です)。
  256. </para>
  257. <para>
  258. 注意: このバックエンドでは、今のところ "タグ" がサポートされていません。
  259. また、引数 "doNotTestCacheValidity=true" もサポートされていません。
  260. </para>
  261. <para>
  262. このバックエンドではオプションを使用しません。
  263. </para>
  264. </sect2>
  265. <sect2 id="zend.cache.backends.xcache">
  266. <title>Zend_Cache_Backend_Xcache</title>
  267. <para>
  268. このバックエンドは、キャッシュレコードを共有メモリに保存する際に
  269. <ulink url="http://xcache.lighttpd.net/">XCache</ulink>
  270. 拡張モジュールを使用します
  271. (当然、このバックエンドを使うにはこの拡張モジュールが必要となります)。
  272. </para>
  273. <para>
  274. 注意: このバックエンドでは、今のところ "タグ" がサポートされていません。
  275. また、引数 "doNotTestCacheValidity=true" もサポートされていません。
  276. </para>
  277. <para>
  278. 使用可能なオプションは次のとおりです。
  279. </para>
  280. <table id="zend.cache.backends.xcache.table">
  281. <title>Xcache バックエンドのオプション</title>
  282. <tgroup cols="4">
  283. <thead>
  284. <row>
  285. <entry>オプション</entry>
  286. <entry>データ型</entry>
  287. <entry>デフォルト値</entry>
  288. <entry>説明</entry>
  289. </row>
  290. </thead>
  291. <tbody>
  292. <row>
  293. <entry><emphasis>user</emphasis></entry>
  294. <entry><type>String</type></entry>
  295. <entry><constant>NULL</constant></entry>
  296. <entry>
  297. <filename>xcache.admin.user</filename> です。
  298. <methodname>clean()</methodname> メソッドを使う際に必要です。
  299. </entry>
  300. </row>
  301. <row>
  302. <entry><emphasis>password</emphasis></entry>
  303. <entry><type>String</type></entry>
  304. <entry><constant>NULL</constant></entry>
  305. <entry>
  306. <filename>xcache.admin.pass</filename> (<acronym>MD5</acronym> ではない平文形式) です。
  307. <methodname>clean()</methodname> メソッドを使う際に必要です。
  308. </entry>
  309. </row>
  310. </tbody>
  311. </tgroup>
  312. </table>
  313. </sect2>
  314. <sect2 id="zend.cache.backends.platform">
  315. <title>Zend_Cache_Backend_ZendPlatform</title>
  316. <para>
  317. このバックエンドは、<ulink url="http://www.zend.co.jp/product/zendplatform.html">Zend Platform</ulink>
  318. 製品のコンテンツキャッシング <acronym>API</acronym> を使用します。当然、このバックエンドを使用するには
  319. Zend Platform をインストールする必要があります。
  320. </para>
  321. <para>
  322. このバックエンドはタグをサポートしています。しかし、
  323. クリーニングモード <constant>CLEANING_MODE_NOT_MATCHING_TAG</constant> はサポートしていません。
  324. </para>
  325. <para>
  326. <methodname>Zend_Cache::factory()</methodname> メソッドでこのバックエンドを指定する場合は、
  327. 'Zend' と 'Platform' の間に区切り文字を入れます。区切り文字としては
  328. '-'、'.'、' ' あるいは '_' が使用できます。
  329. </para>
  330. <programlisting language="php"><![CDATA[
  331. $cache = Zend_Cache::factory('Core', 'Zend Platform');
  332. ]]></programlisting>
  333. <para>
  334. このバックエンドではオプションを使用しません。
  335. </para>
  336. </sect2>
  337. <sect2 id="zend.cache.backends.twolevels">
  338. <title>Zend_Cache_Backend_TwoLevels</title>
  339. <para>
  340. この (拡張) バックエンドは複合型です。
  341. キャッシュレコードを、
  342. 高速 (だが制限付き) な Apc、Memcache…… および "低速"
  343. な File、Sqlite…… の 2 種類の別々のバックエンドに格納します。
  344. </para>
  345. <para>
  346. このバックエンドは priority パラメータを使用 (フロントエンドレベルで、記録開始時に指定)
  347. し、高速バックエンドの残りのスペースを用いてふたつのバックエンドの使用を最適化します。
  348. </para>
  349. <para>
  350. <methodname>Zend_Cache::factory()</methodname> メソッドでこのバックエンドを指定する場合は、
  351. 'Two' と 'Levels' の間に区切り文字を入れます。区切り文字としては
  352. '-'、'.'、' ' あるいは '_' が使用できます。
  353. </para>
  354. <programlisting language="php"><![CDATA[
  355. $cache = Zend_Cache::factory('Core', 'Two Levels');
  356. ]]></programlisting>
  357. <para>
  358. 使用可能なオプションは次のとおりです。
  359. </para>
  360. <table id="zend.cache.backends.twolevels.table">
  361. <title>TwoLevels バックエンドのオプション</title>
  362. <tgroup cols="4">
  363. <thead>
  364. <row>
  365. <entry>オプション</entry>
  366. <entry>データ型</entry>
  367. <entry>デフォルト値</entry>
  368. <entry>説明</entry>
  369. </row>
  370. </thead>
  371. <tbody>
  372. <row>
  373. <entry><emphasis>slow_backend</emphasis></entry>
  374. <entry><type>String</type></entry>
  375. <entry>File</entry>
  376. <entry>
  377. "低速" バックエンドの名前。
  378. </entry>
  379. </row>
  380. <row>
  381. <entry><emphasis>fast_backend</emphasis></entry>
  382. <entry><type>String</type></entry>
  383. <entry>Apc</entry>
  384. <entry>
  385. "高速" バックエンドの名前。
  386. </entry>
  387. </row>
  388. <row>
  389. <entry><emphasis>slow_backend_options</emphasis></entry>
  390. <entry><type>Array</type></entry>
  391. <entry><methodname>array()</methodname></entry>
  392. <entry>
  393. "低速" バックエンドのオプション。
  394. </entry>
  395. </row>
  396. <row>
  397. <entry><emphasis>fast_backend_options</emphasis></entry>
  398. <entry><type>Array</type></entry>
  399. <entry><methodname>array()</methodname></entry>
  400. <entry>
  401. "高速" バックエンドのオプション。
  402. </entry>
  403. </row>
  404. <row>
  405. <entry><emphasis>slow_backend_custom_naming</emphasis></entry>
  406. <entry><type>Boolean</type></entry>
  407. <entry><constant>FALSE</constant></entry>
  408. <entry>
  409. <constant>TRUE</constant> の場合は、引数 slow_backend を完全なクラス名として使用します。
  410. <constant>FALSE</constant> の場合は、引数をクラス名 "<classname>Zend_Cache_Backend_</classname>[...]"
  411. の最後の部分として使用します。
  412. </entry>
  413. </row>
  414. <row>
  415. <entry><emphasis>fast_backend_custom_naming</emphasis></entry>
  416. <entry><type>Boolean</type></entry>
  417. <entry><constant>FALSE</constant></entry>
  418. <entry>
  419. <constant>TRUE</constant> の場合は、引数 fast_backend を完全なクラス名として使用します。
  420. <constant>FALSE</constant> の場合は、引数をクラス名 "<classname>Zend_Cache_Backend_</classname>[...]"
  421. の最後の部分として使用します。
  422. </entry>
  423. </row>
  424. <row>
  425. <entry><emphasis>slow_backend_autoload</emphasis></entry>
  426. <entry><type>Boolean</type></entry>
  427. <entry><constant>FALSE</constant></entry>
  428. <entry>
  429. <constant>TRUE</constant> の場合は、低速バックエンドに対して require_once を行いません
  430. (独自のバックエンドを使用する場合にのみ有用です)。
  431. </entry>
  432. </row>
  433. <row>
  434. <entry><emphasis>fast_backend_autoload</emphasis></entry>
  435. <entry><type>Boolean</type></entry>
  436. <entry><constant>FALSE</constant></entry>
  437. <entry>
  438. <constant>TRUE</constant> の場合は、高速バックエンドに対して require_once を行いません
  439. (独自のバックエンドを使用する場合にのみ有用です)。
  440. </entry>
  441. </row>
  442. <row>
  443. <entry><emphasis>auto_refresh_fast_cache</emphasis></entry>
  444. <entry><type>Boolean</type></entry>
  445. <entry><constant>TRUE</constant></entry>
  446. <entry>
  447. <constant>TRUE</constant> の場合は、キャッシュレコードにヒットしたときに
  448. 高速キャッシュを自動的にリフレッシュします。
  449. </entry>
  450. </row>
  451. <row>
  452. <entry><emphasis>stats_update_factor</emphasis></entry>
  453. <entry><type>Integer</type></entry>
  454. <entry>10</entry>
  455. <entry>
  456. 高速バックエンドを使用率の計算を無効化 / 効率化します
  457. (レコードをキャッシュに書き込む際の
  458. 高速バックエンド使用率の計算は、
  459. キャッシュ書き込み x 回につき 1 回の割合でランダムに行われます)。
  460. </entry>
  461. </row>
  462. </tbody>
  463. </tgroup>
  464. </table>
  465. </sect2>
  466. <sect2 id="zend.cache.backends.zendserver">
  467. <title>Zend_Cache_Backend_ZendServer_Disk および Zend_Cache_Backend_ZendServer_ShMem</title>
  468. <para>
  469. これらのバックエンドは、キャッシュレコードの保存に
  470. <ulink url="http://www.zend.com/en/products/server/downloads-all?zfs=zf_download">Zend Server</ulink>
  471. のキャッシュ機能を使用します。
  472. </para>
  473. <para>
  474. 注意: このバックエンドでは、今のところ "タグ" がサポートされていません。
  475. また、引数 "doNotTestCacheValidity=true" もサポートされていません。
  476. </para>
  477. <para>
  478. これらのバックエンドが動作するのは、Zend Server 環境で
  479. <acronym>HTTP</acronym> あるいは <acronym>HTTPS</acronym>
  480. 越しにページをリクエストした場合のみです。
  481. コマンドラインでスクリプトを実行した場合は動作しません。
  482. </para>
  483. <para>
  484. <methodname>Zend_Cache::factory()</methodname> メソッドでこのバックエンドを指定する場合は、
  485. パラメータ <emphasis>customBackendNaming</emphasis> を <constant>TRUE</constant> とします。
  486. </para>
  487. <programlisting language="php"><![CDATA[
  488. $cache = Zend_Cache::factory('Core', 'Zend_Cache_Backend_ZendServer_Disk',
  489. $frontendOptions, $backendOptions, false, true);
  490. ]]></programlisting>
  491. <para>
  492. このバックエンドにはオプションはありません。
  493. </para>
  494. </sect2>
  495. </sect1>
  496. <!--
  497. vim:se ts=4 sw=4 et:
  498. -->