/php/wincache.reroutes.html

https://bitbucket.org/thncr/manuals · HTML · 119 lines · 116 code · 3 blank · 0 comment · 0 complexity · 02373b5195ad76b5f1cebda7d29209b5 MD5 · raw file

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  5. <title>WinCache Functions Reroutes</title>
  6. </head>
  7. <body><div class="manualnavbar" style="text-align: center;">
  8. <div class="prev" style="text-align: left; float: left;"><a href="wincache.sessionhandler.html">WinCache Session Handler</a></div>
  9. <div class="next" style="text-align: right; float: right;"><a href="wincache.resources.html">资源类型</a></div>
  10. <div class="up"><a href="wincache.setup.html">安装配置</a></div>
  11. <div class="home"><a href="index.html">PHP Manual</a></div>
  12. </div><hr /><div id="wincache.reroutes" class="section">
  13. <h2 class="title">WinCache Functions Reroutes</h2>
  14. <p class="para">
  15. The WinCache functions reroutes (available since WinCache 1.2.0) can be used to replace built-in PHP functions with their equivalents
  16. that are optimized for a particular purpose. WinCache extension includes Windows-optimized implementation of PHP file functions that
  17. may improve performance of PHP applications in cases when PHP has to access files on network shares. The optimized implementation is
  18. provided for the following functions:
  19. </p>
  20. <ul class="itemizedlist">
  21. <li class="listitem">
  22. <span class="simpara">
  23. <a href="function.file-exists.html" class="link">file_exists</a>
  24. </span>
  25. </li>
  26. <li class="listitem">
  27. <span class="simpara">
  28. <a href="function.file-get-contents.html" class="link">file_get_contents</a>
  29. </span>
  30. </li>
  31. <li class="listitem">
  32. <span class="simpara">
  33. <a href="function.readfile.html" class="link">readfile</a>
  34. </span>
  35. </li>
  36. <li class="listitem">
  37. <span class="simpara">
  38. <a href="function.is-readable.html" class="link">is_readable</a>
  39. </span>
  40. </li>
  41. <li class="listitem">
  42. <span class="simpara">
  43. <a href="function.is-writable.html" class="link">is_writable</a>
  44. </span>
  45. </li>
  46. <li class="listitem">
  47. <span class="simpara">
  48. <a href="function.is-dir.html" class="link">is_dir</a>
  49. </span>
  50. </li>
  51. <li class="listitem">
  52. <span class="simpara">
  53. <a href="function.realpath.html" class="link">realpath</a>
  54. </span>
  55. </li>
  56. <li class="listitem">
  57. <span class="simpara">
  58. <a href="function.filesize.html" class="link">filesize</a>
  59. </span>
  60. </li>
  61. </ul>
  62. <p class="para">
  63. To configure WinCache to use the functions reroutes use the file <var class="filename">reroute.ini</var> that is included in
  64. WinCache installation package. Copy this file into the same directory where <var class="filename">php.ini</var>
  65. file is located. After that add the wincache.rerouteini setting in <var class="filename">php.ini</var>
  66. and specify an absolute or relative path to the <var class="filename">reroute.ini</var> file.
  67. <div class="example" id="example-509">
  68. <p><strong>Example #1 Enabling WinCache functions reroutes</strong></p>
  69. <div class="example-contents">
  70. <div class="php.inicode"><pre class="php.inicode">wincache.rerouteini = C:\PHP\reroute.ini</pre>
  71. </div>
  72. </div>
  73. </div>
  74. </p>
  75. <blockquote class="note"><p><strong class="note">Note</strong>:
  76. <span class="simpara">
  77. If WinCache functions reroutes are enabled it is recommended to increase the WinCache file cache size. This
  78. can be done by using <a href="wincache.configuration.html#ini.wincache.fcachesize" class="link">wincache.fcachesize</a> setting.
  79. </span>
  80. </p></blockquote>
  81. <p class="para">
  82. The <var class="filename">reroute.ini</var> file contains the mappings between the native PHP functions and
  83. their equivalents in WinCache. Each line in the file defines a mapping by using the following syntax:
  84. </p>
  85. <p class="simpara">
  86. <em>&lt;PHP function name&gt;:[&lt;number of function parameters&gt;]=&lt;wincache function name&gt;</em>
  87. </p>
  88. <p class="para">
  89. The example of the file is shown below. In this example the calls to PHP function <span class="function"><a href="function.file-get-contents.html" class="function">file_get_contents()</a></span>
  90. will be replaced with calls to <span class="function"><strong>wincache_file_get_contents()</strong></span> only if the number of parameters passed to
  91. the function is less than or equals to 2. Specifying the number of parameters is useful when replacement function
  92. does not handle all the function&#039;s parameters.
  93. <div class="example" id="example-510">
  94. <p><strong>Example #2 Reroute.ini file content</strong></p>
  95. <div class="example-contents">
  96. <div class="php.inicode"><pre class="php.inicode">[FunctionRerouteList]
  97. file_exists=wincache_file_exists
  98. file_get_contents:2=wincache_file_get_contents
  99. readfile:2=wincache_readfile
  100. is_readable=wincache_is_readable
  101. is_writable=wincache_is_writable
  102. is_writeable=wincache_is_writable
  103. is_file=wincache_is_file
  104. is_dir=wincache_is_dir
  105. realpath=wincache_realpath
  106. filesize=wincache_filesize</pre>
  107. </div>
  108. </div>
  109. </div>
  110. </p>
  111. </div><hr /><div class="manualnavbar" style="text-align: center;">
  112. <div class="prev" style="text-align: left; float: left;"><a href="wincache.sessionhandler.html">WinCache Session Handler</a></div>
  113. <div class="next" style="text-align: right; float: right;"><a href="wincache.resources.html">资源类型</a></div>
  114. <div class="up"><a href="wincache.setup.html">安装配置</a></div>
  115. <div class="home"><a href="index.html">PHP Manual</a></div>
  116. </div></body></html>