| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- Reviewed: no -->
- <!-- EN-Revision: 17749 -->
- <sect1 id="zend.cache.backends">
- <title><classname>Zend_Cache</classname> のバックエンド</title>
- <para>
- バックエンドには、標準と拡張の 2 種類があります。
- もちろん、拡張バックエンドのほうがより高機能となります。
- </para>
- <sect2 id="zend.cache.backends.file">
- <title>Zend_Cache_Backend_File</title>
- <para>
- この (拡張) バックエンドは、キャッシュレコードを
- (指定したディレクトリの) ファイルに保存します。
- </para>
- <para>
- 使用可能なオプションは次のとおりです。
- </para>
- <table id="zend.cache.backends.file.table">
- <title>File バックエンドのオプション</title>
- <tgroup cols="4">
- <thead>
- <row>
- <entry>オプション</entry>
- <entry>データ型</entry>
- <entry>デフォルト値</entry>
- <entry>説明</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><emphasis>cache_dir</emphasis></entry>
- <entry><type>String</type></entry>
- <entry>'<filename>/tmp/</filename>'</entry>
- <entry>
- キャッシュファイルを書き込むディレクトリ。
- </entry>
- </row>
- <row>
- <entry><emphasis>file_locking</emphasis></entry>
- <entry><type>Boolean</type></entry>
- <entry><constant>TRUE</constant></entry>
- <entry>
- ファイルロックを有効/無効にします。
- 不慮の事故でキャッシュが破壊されることを防げますが、
- マルチスレッドなウェブサーバ環境や <acronym>NFS</acronym> ファイルシステム上では役に立ちません。
- </entry>
- </row>
- <row>
- <entry><emphasis>read_control</emphasis></entry>
- <entry><type>Boolean</type></entry>
- <entry><constant>TRUE</constant></entry>
- <entry>
- 読み込み制御を有効/無効にします。有効にすると
- キャッシュファイルに制御キーが埋め込まれます。
- キャッシュの読み込み後、計算した結果とキャッシュのキーを比較します。
- </entry>
- </row>
- <row>
- <entry><emphasis>read_control_type</emphasis></entry>
- <entry><type>String</type></entry>
- <entry>'crc32'</entry>
- <entry>
- 読み込み制御の方式 (読み込み制御が有効な場合にのみ使用します)。
- 使用可能な値は
- 'md5' (一番安全だが、最も遅い)、
- 'crc32' (安全性には劣るが、より高速。悪くない選択肢です)、
- 'adler32' (新たな選択肢。crc32 より高速です)、
- 'strlen' (最も高速。長さのみをチェックします)
- のいずれかです。
- </entry>
- </row>
- <row>
- <entry><emphasis>hashed_directory_level</emphasis></entry>
- <entry><type>Integer</type></entry>
- <entry>0</entry>
- <entry>
- ディレクトリ構造のレベルを指定します。0 は "ディレクトリ階層を作らない"、
- 1 は "一段階のサブディレクトリを作る"、2 は "二段階の……" を意味します。
- 何千ものキャッシュファイルを使用する場合にのみ、
- このオプションによる高速化を実感できるでしょう。
- 適切な設定値を決めるには、実際にベンチマークを取得するしかありません。
- たいていの場合は 1 または 2 でよいでしょう。
- </entry>
- </row>
- <row>
- <entry><emphasis>hashed_directory_umask</emphasis></entry>
- <entry><type>Integer</type></entry>
- <entry>0700</entry>
- <entry>
- ディレクトリ構造の umask を指定します。
- </entry>
- </row>
- <row>
- <entry><emphasis>file_name_prefix</emphasis></entry>
- <entry><type>String</type></entry>
- <entry>'zend_cache'</entry>
- <entry>
- キャッシュファイルのプレフィックスを設定します。
- このオプションを設定する際には十分注意しましょう。
- あまりにもありふれた値をシステムのキャッシュディレクトリ
- (<filename>/tmp</filename> など) で使用すると、
- キャッシュの削除の際に余計なものまで削除されてしまうはめになります。
- </entry>
- </row>
- <row>
- <entry><emphasis>cache_file_umask</emphasis></entry>
- <entry><type>Integer</type></entry>
- <entry>0700</entry>
- <entry>
- キャッシュファイルの umask を設定します。
- </entry>
- </row>
- <row>
- <entry><emphasis>metatadatas_array_max_size</emphasis></entry>
- <entry><type>Integer</type></entry>
- <entry>100</entry>
- <entry>
- メタデータ配列の内部最大サイズを設定します
- (よくわからない場合はこの値を変更してはいけません)。
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </sect2>
- <sect2 id="zend.cache.backends.sqlite">
- <title>Zend_Cache_Backend_Sqlite</title>
- <para>
- この (拡張) バックエンドは、キャッシュレコードを
- SQLite データベースに保存します。
- </para>
- <para>
- 使用可能なオプションは次のとおりです。
- </para>
- <table id="zend.cache.backends.sqlite.table">
- <title>Sqlite バックエンドのオプション</title>
- <tgroup cols="4">
- <thead>
- <row>
- <entry>オプション</entry>
- <entry>データ型</entry>
- <entry>デフォルト値</entry>
- <entry>説明</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><emphasis>cache_db_complete_path (必須)</emphasis></entry>
- <entry><type>String</type></entry>
- <entry><constant>NULL</constant></entry>
- <entry>
- SQLite データベースへの (ファイル名も含めた) フルパス。
- </entry>
- </row>
- <row>
- <entry><emphasis>automatic_vacuum_factor</emphasis></entry>
- <entry><type>Integer</type></entry>
- <entry>10</entry>
- <entry>
- 自動バキューム処理の設定を行います。
- 自動バキューム処理とは、<methodname>clean()</methodname> や <methodname>delete()</methodname>
- がコールされた際に自動的にデータベースの断片化解消を行う
- (そしてサイズを縮小する) ことです。
- 0 を指定すると、自動バキュームを行いません。
- 1 を指定すると (<methodname>delete()</methodname> や <methodname>clean()</methodname>
- がコールされると) そのたびにバキュームを行います。
- x (1 より大きな整数) を指定すると、
- <methodname>clean()</methodname> や <methodname>delete()</methodname> が x 回コールされるたびに
- 一回の頻度でランダムに自動バキュームを行います。
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </sect2>
- <sect2 id="zend.cache.backends.memcached">
- <title>Zend_Cache_Backend_Memcached</title>
- <para>
- この (拡張) バックエンドは、キャッシュレコードを memcached サーバに保存します。
- <ulink url="http://www.danga.com/memcached/">memcached</ulink> は、
- 高性能な分散メモリオブジェクトキャッシュシステムです。このバックエンドを使用するには、
- memcached デーモンおよび
- <ulink url="http://pecl.php.net/package/memcache">memcache <acronym>PECL</acronym> 拡張モジュール</ulink>
- が必要です。
- </para>
- <para>
- 注意: このバックエンドでは、今のところ "タグ" がサポートされていません。
- また、引数 "doNotTestCacheValidity=true" もサポートされていません。
- </para>
- <para>
- 使用可能なオプションは次のとおりです。
- </para>
- <table id="zend.cache.backends.memcached.table">
- <title>Memcached バックエンドのオプション</title>
- <tgroup cols="4">
- <thead>
- <row>
- <entry>オプション</entry>
- <entry>データ型</entry>
- <entry>デフォルト値</entry>
- <entry>説明</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><emphasis>servers</emphasis></entry>
- <entry><type>Array</type></entry>
- <entry>
- <command>array(array('host' => 'localhost', 'port' => 11211,
- 'persistent' => true, 'weight' => 1, 'timeout' => 5,
- 'retry_interval' => 15, 'status' => true,
- 'failure_callback' => '' ))</command>
- </entry>
- <entry>
- memcached サーバの配列です。各 memcached サーバの情報は、
- 以下のような連想配列で指定します。
- 'host' => (string) : memcached サーバのサーバ名
- 'port' => (int) : memcached サーバのポート番号
- 'persistent' => (bool) : この memcached サーバに対して持続的な接続を使用するかどうか
- 'weight' => (int) : memcached サーバの重み付け
- 'timeout' => (int) : memcached サーバのタイムアウト
- 'retry_interval' => (int) : memcached サーバの再試行間隔
- 'status' => (bool) : memcached サーバのステータス
- 'failure_callback' => (callback) : memcached サーバのコールバック関数
- </entry>
- </row>
- <row>
- <entry><emphasis>compression</emphasis></entry>
- <entry><type>Boolean</type></entry>
- <entry><constant>FALSE</constant></entry>
- <entry>
- その場での圧縮処理を行いたい場合に <constant>TRUE</constant> を指定します。
- </entry>
- </row>
- <row>
- <entry><emphasis>compatibility</emphasis></entry>
- <entry><type>Boolean</type></entry>
- <entry><constant>FALSE</constant></entry>
- <entry>
- 古い memcache サーバ/拡張モジュールとの互換性モードを使用したい場合に
- <constant>TRUE</constant> を指定します。
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </sect2>
- <sect2 id="zend.cache.backends.apc">
- <title>Zend_Cache_Backend_Apc</title>
- <para>
- この (拡張) バックエンドは、キャッシュレコードを共有メモリに保存する際に
- <ulink url="http://pecl.php.net/package/APC">APC</ulink> (Alternative <acronym>PHP</acronym> Cache)
- 拡張モジュールを使用します
- (当然、このバックエンドを使用するにはこの拡張モジュールが必要です)。
- </para>
- <para>
- 注意: このバックエンドでは、今のところ "タグ" がサポートされていません。
- また、引数 "doNotTestCacheValidity=true" もサポートされていません。
- </para>
- <para>
- このバックエンドではオプションを使用しません。
- </para>
- </sect2>
- <sect2 id="zend.cache.backends.xcache">
- <title>Zend_Cache_Backend_Xcache</title>
- <para>
- このバックエンドは、キャッシュレコードを共有メモリに保存する際に
- <ulink url="http://xcache.lighttpd.net/">XCache</ulink>
- 拡張モジュールを使用します
- (当然、このバックエンドを使うにはこの拡張モジュールが必要となります)。
- </para>
- <para>
- 注意: このバックエンドでは、今のところ "タグ" がサポートされていません。
- また、引数 "doNotTestCacheValidity=true" もサポートされていません。
- </para>
- <para>
- 使用可能なオプションは次のとおりです。
- </para>
- <table id="zend.cache.backends.xcache.table">
- <title>Xcache バックエンドのオプション</title>
- <tgroup cols="4">
- <thead>
- <row>
- <entry>オプション</entry>
- <entry>データ型</entry>
- <entry>デフォルト値</entry>
- <entry>説明</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><emphasis>user</emphasis></entry>
- <entry><type>String</type></entry>
- <entry><constant>NULL</constant></entry>
- <entry>
- <filename>xcache.admin.user</filename> です。
- <methodname>clean()</methodname> メソッドを使う際に必要です。
- </entry>
- </row>
- <row>
- <entry><emphasis>password</emphasis></entry>
- <entry><type>String</type></entry>
- <entry><constant>NULL</constant></entry>
- <entry>
- <filename>xcache.admin.pass</filename> (<acronym>MD5</acronym> ではない平文形式) です。
- <methodname>clean()</methodname> メソッドを使う際に必要です。
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </sect2>
- <sect2 id="zend.cache.backends.platform">
- <title>Zend_Cache_Backend_ZendPlatform</title>
- <para>
- このバックエンドは、<ulink url="http://www.zend.co.jp/product/zendplatform.html">Zend Platform</ulink>
- 製品のコンテンツキャッシング <acronym>API</acronym> を使用します。当然、このバックエンドを使用するには
- Zend Platform をインストールする必要があります。
- </para>
- <para>
- このバックエンドはタグをサポートしています。しかし、
- クリーニングモード <constant>CLEANING_MODE_NOT_MATCHING_TAG</constant> はサポートしていません。
- </para>
- <para>
- <methodname>Zend_Cache::factory()</methodname> メソッドでこのバックエンドを指定する場合は、
- 'Zend' と 'Platform' の間に区切り文字を入れます。区切り文字としては
- '-'、'.'、' ' あるいは '_' が使用できます。
- </para>
- <programlisting language="php"><![CDATA[
- $cache = Zend_Cache::factory('Core', 'Zend Platform');
- ]]></programlisting>
- <para>
- このバックエンドではオプションを使用しません。
- </para>
- </sect2>
- <sect2 id="zend.cache.backends.twolevels">
- <title>Zend_Cache_Backend_TwoLevels</title>
- <para>
- この (拡張) バックエンドは複合型です。
- キャッシュレコードを、
- 高速 (だが制限付き) な Apc、Memcache…… および "低速"
- な File、Sqlite…… の 2 種類の別々のバックエンドに格納します。
- </para>
- <para>
- このバックエンドは priority パラメータを使用 (フロントエンドレベルで、記録開始時に指定)
- し、高速バックエンドの残りのスペースを用いてふたつのバックエンドの使用を最適化します。
- </para>
- <para>
- <methodname>Zend_Cache::factory()</methodname> メソッドでこのバックエンドを指定する場合は、
- 'Two' と 'Levels' の間に区切り文字を入れます。区切り文字としては
- '-'、'.'、' ' あるいは '_' が使用できます。
- </para>
- <programlisting language="php"><![CDATA[
- $cache = Zend_Cache::factory('Core', 'Two Levels');
- ]]></programlisting>
- <para>
- 使用可能なオプションは次のとおりです。
- </para>
- <table id="zend.cache.backends.twolevels.table">
- <title>TwoLevels バックエンドのオプション</title>
- <tgroup cols="4">
- <thead>
- <row>
- <entry>オプション</entry>
- <entry>データ型</entry>
- <entry>デフォルト値</entry>
- <entry>説明</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><emphasis>slow_backend</emphasis></entry>
- <entry><type>String</type></entry>
- <entry>File</entry>
- <entry>
- "低速" バックエンドの名前。
- </entry>
- </row>
- <row>
- <entry><emphasis>fast_backend</emphasis></entry>
- <entry><type>String</type></entry>
- <entry>Apc</entry>
- <entry>
- "高速" バックエンドの名前。
- </entry>
- </row>
- <row>
- <entry><emphasis>slow_backend_options</emphasis></entry>
- <entry><type>Array</type></entry>
- <entry><methodname>array()</methodname></entry>
- <entry>
- "低速" バックエンドのオプション。
- </entry>
- </row>
- <row>
- <entry><emphasis>fast_backend_options</emphasis></entry>
- <entry><type>Array</type></entry>
- <entry><methodname>array()</methodname></entry>
- <entry>
- "高速" バックエンドのオプション。
- </entry>
- </row>
- <row>
- <entry><emphasis>slow_backend_custom_naming</emphasis></entry>
- <entry><type>Boolean</type></entry>
- <entry><constant>FALSE</constant></entry>
- <entry>
- <constant>TRUE</constant> の場合は、引数 slow_backend を完全なクラス名として使用します。
- <constant>FALSE</constant> の場合は、引数をクラス名 "<classname>Zend_Cache_Backend_</classname>[...]"
- の最後の部分として使用します。
- </entry>
- </row>
- <row>
- <entry><emphasis>fast_backend_custom_naming</emphasis></entry>
- <entry><type>Boolean</type></entry>
- <entry><constant>FALSE</constant></entry>
- <entry>
- <constant>TRUE</constant> の場合は、引数 fast_backend を完全なクラス名として使用します。
- <constant>FALSE</constant> の場合は、引数をクラス名 "<classname>Zend_Cache_Backend_</classname>[...]"
- の最後の部分として使用します。
- </entry>
- </row>
- <row>
- <entry><emphasis>slow_backend_autoload</emphasis></entry>
- <entry><type>Boolean</type></entry>
- <entry><constant>FALSE</constant></entry>
- <entry>
- <constant>TRUE</constant> の場合は、低速バックエンドに対して require_once を行いません
- (独自のバックエンドを使用する場合にのみ有用です)。
- </entry>
- </row>
- <row>
- <entry><emphasis>fast_backend_autoload</emphasis></entry>
- <entry><type>Boolean</type></entry>
- <entry><constant>FALSE</constant></entry>
- <entry>
- <constant>TRUE</constant> の場合は、高速バックエンドに対して require_once を行いません
- (独自のバックエンドを使用する場合にのみ有用です)。
- </entry>
- </row>
- <row>
- <entry><emphasis>auto_refresh_fast_cache</emphasis></entry>
- <entry><type>Boolean</type></entry>
- <entry><constant>TRUE</constant></entry>
- <entry>
- <constant>TRUE</constant> の場合は、キャッシュレコードにヒットしたときに
- 高速キャッシュを自動的にリフレッシュします。
- </entry>
- </row>
- <row>
- <entry><emphasis>stats_update_factor</emphasis></entry>
- <entry><type>Integer</type></entry>
- <entry>10</entry>
- <entry>
- 高速バックエンドを使用率の計算を無効化 / 効率化します
- (レコードをキャッシュに書き込む際の
- 高速バックエンド使用率の計算は、
- キャッシュ書き込み x 回につき 1 回の割合でランダムに行われます)。
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </sect2>
- <sect2 id="zend.cache.backends.zendserver">
- <title>Zend_Cache_Backend_ZendServer_Disk および Zend_Cache_Backend_ZendServer_ShMem</title>
- <para>
- これらのバックエンドは、キャッシュレコードの保存に
- <ulink url="http://www.zend.com/en/products/server/downloads-all?zfs=zf_download">Zend Server</ulink>
- のキャッシュ機能を使用します。
- </para>
- <para>
- 注意: このバックエンドでは、今のところ "タグ" がサポートされていません。
- また、引数 "doNotTestCacheValidity=true" もサポートされていません。
- </para>
- <para>
- これらのバックエンドが動作するのは、Zend Server 環境で
- <acronym>HTTP</acronym> あるいは <acronym>HTTPS</acronym>
- 越しにページをリクエストした場合のみです。
- コマンドラインでスクリプトを実行した場合は動作しません。
- </para>
- <para>
- <methodname>Zend_Cache::factory()</methodname> メソッドでこのバックエンドを指定する場合は、
- パラメータ <emphasis>customBackendNaming</emphasis> を <constant>TRUE</constant> とします。
- </para>
- <programlisting language="php"><![CDATA[
- $cache = Zend_Cache::factory('Core', 'Zend_Cache_Backend_ZendServer_Disk',
- $frontendOptions, $backendOptions, false, true);
- ]]></programlisting>
- <para>
- このバックエンドにはオプションはありません。
- </para>
- </sect2>
- </sect1>
- <!--
- vim:se ts=4 sw=4 et:
- -->
|