<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/wincache.setup.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'wincache.reroutes.php',
    1 => 'WinCache 関数への切り替え',
    2 => 'WinCache 関数への切り替え',
  ),
  'up' => 
  array (
    0 => 'wincache.setup.php',
    1 => 'インストール/設定',
  ),
  'prev' => 
  array (
    0 => 'wincache.sessionhandler.php',
    1 => 'WinCache セッションハンドラ',
  ),
  'next' => 
  array (
    0 => 'ref.wincache.php',
    1 => 'WinCache 関数',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/wincache/setup.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="wincache.reroutes" class="section">
  <h2 class="title">WinCache 関数への切り替え</h2>
  <p class="para">
   <em>注意:</em> <a href="wincache.configuration.php#ini.wincache.rerouteini" class="link">wincache.rerouteini</a>
   は WinCache 1.3.7.0 で削除されました。かわりに、自動的な関数置き換え機能を利用します。
   <a href="wincache.configuration.php#ini.wincache.reroute_enabled" class="link">wincache.reroute_enabled</a> を参照ください。
  </p>
  <p class="para">
   WinCache の関数切り替え機能 (WinCache 1.2.0 以降で使用可能で、WinCache 1.3.7.0 で削除されました) を使うと、
   その用途向けに最適化した同等の関数で組み込みの PHP 関数を置き換えることができます。
   WinCache 拡張モジュールには、PHP のファイル操作関数を Windows
   向けに最適化した実装が含まれています。PHP でネットワーク共有上のファイルにアクセスする必要がある場合などに、
   これを使うとアプリケーションのパフォーマンスを向上させることができるでしょう。
   最適化した実装が用意されている関数は、次のとおりです。
  </p>
  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara">
     <a href="function.file-exists.php" class="link">file_exists</a>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <a href="function.file-get-contents.php" class="link">file_get_contents</a>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <a href="function.readfile.php" class="link">readfile</a>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <a href="function.is-readable.php" class="link">is_readable</a>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <a href="function.is-writable.php" class="link">is_writable</a>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <a href="function.is-dir.php" class="link">is_dir</a>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <a href="function.realpath.php" class="link">realpath</a>
    </span>
   </li>
      <li class="listitem">
    <span class="simpara">
     <a href="function.filesize.php" class="link">filesize</a>
    </span>
   </li>
  </ul>
  <p class="para">
   WinCache の関数切り替え機能を使えるよう設定するには、WinCache のインストールパッケージに含まれている
   <var class="filename">reroute.ini</var> ファイルを使います。このファイルを
   <var class="filename">php.ini</var> があるディレクトリにコピーしましょう。
   それから <var class="filename">php.ini</var> に wincache.rerouteini
   の設定を追加し、ここに <var class="filename">reroute.ini</var> ファイルへの絶対パスあるいは相対パスを指定します。
   <div class="example" id="example-1">
    <p><strong>例1 WinCache の関数切り替えの有効化</strong></p>
    <div class="example-contents">
<div class="php.inicode"><pre class="php.inicode">wincache.rerouteini = C:\PHP\reroute.ini</pre>
</div>
    </div>

   </div>
  </p>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <span class="simpara">
    WinCache の関数切り替え機能を使う場合は、ファイルキャッシュのサイズを増やすことを推奨します。
    このサイズは <a href="wincache.configuration.php#ini.wincache.fcachesize" class="link">wincache.fcachesize</a> を使って設定します。
   </span>
  </p></blockquote>
  <p class="para">
   <var class="filename">reroute.ini</var> ファイルには、PHP の関数とそれに対応する
   WinCache の関数のマッピングを記述します。
   ファイルの各行に、次の構文で関数のマッピングを定義します。
  </p>
  <p class="simpara">
   <code class="literal">&lt;PHP の関数名&gt;:[&lt;関数のパラメータの数&gt;]=&lt;wincache の関数名&gt;</code>
  </p>
  <p class="para">
   ファイルの例を以下に示します。この例では、PHP の関数 <span class="function"><a href="function.file-get-contents.php" class="function">file_get_contents()</a></span>
   がコールされると、それが <span class="function"><strong>wincache_file_get_contents()</strong></span> へのコールに置き換えられます。
   ただし、関数に渡されたパラメータが 2 個以下の場合に限ります。パラメータ数の指定が役立つのは、
   置き換え用の関数が元の関数のすべてのパラメータに対応しているわけではないという場合です。
   <div class="example" id="example-2">
    <p><strong>例2 Reroute.ini ファイルの内容</strong></p>
    <div class="example-contents">
 <div class="php.inicode"><pre class="php.inicode">[FunctionRerouteList]
file_exists=wincache_file_exists
file_get_contents:2=wincache_file_get_contents
readfile:2=wincache_readfile
is_readable=wincache_is_readable
is_writable=wincache_is_writable
is_writeable=wincache_is_writable
is_file=wincache_is_file
is_dir=wincache_is_dir
realpath=wincache_realpath
filesize=wincache_filesize</pre>
</div>
    </div>

   </div>
  </p>
 </div><?php manual_footer($setup); ?>