Zend_Cache-Backends.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <sect1 id="zend.cache.backends">
  2. <title>Zend_Cache后端</title>
  3. <sect2 id="zend.cache.backends.file">
  4. <title>Zend_Cache_Backend_File</title>
  5. <para>
  6. 此后端把缓存纪录存储到文件中去(在一个选定的目录中).
  7. </para>
  8. <para>
  9. 可用的选项有 :
  10. </para>
  11. <table id="zend.cache.backends.file.table">
  12. <title>文件后端选项</title>
  13. <tgroup cols="4">
  14. <thead>
  15. <row>
  16. <entry>选项</entry>
  17. <entry>数据类型</entry>
  18. <entry>默认值</entry>
  19. <entry>描述</entry>
  20. </row>
  21. </thead>
  22. <tbody>
  23. <row>
  24. <entry><code>cache_dir</code></entry>
  25. <entry><code>string</code></entry>
  26. <entry><code>'/tmp/'</code></entry>
  27. <entry>
  28. 存放缓存文件的目录
  29. </entry>
  30. </row>
  31. <row>
  32. <entry><code>file_locking</code></entry>
  33. <entry><code>boolean</code></entry>
  34. <entry><code>true</code></entry>
  35. <entry>
  36. 启用/禁用文件锁定 :
  37. 在比较坏的情况下,能够避免缓存中断,但在多线程Web服务器或者NFS文件系统中没有任何帮助.
  38. </entry>
  39. </row>
  40. <row>
  41. <entry><code>read_control</code></entry>
  42. <entry><code>boolean</code></entry>
  43. <entry><code>true</code></entry>
  44. <entry>
  45. 启用/禁用读控制:
  46. 如果启用,控制键被嵌入到缓存文件中,并且这个键将与读取后计算出的值进行比较.
  47. </entry>
  48. </row>
  49. <row>
  50. <entry><code>read_control_type</code></entry>
  51. <entry><code>string</code></entry>
  52. <entry><code>'crc32'</code></entry>
  53. <entry>
  54. 读控制类型 (仅在读控制启用时). 可用的值有: 'md5' (最好但最慢),
  55. 'crc32' (安全性稍差,但更快,更好的选择),
  56. 'adler32' (新选择,比 crc32 快),
  57. 'strlen' for a length only test (最快).
  58. </entry>
  59. </row>
  60. <row>
  61. <entry><code>hashed_directory_level</code></entry>
  62. <entry><code>int</code></entry>
  63. <entry><code>0</code></entry>
  64. <entry>
  65. Hash目录结构层次: 0 表示"不使用hash的目录结构", 1 表示"一级目录结构"
  66. , 2表示"二级目录"...
  67. 次选项在你有成千上万的缓存文件是能够加速缓存.只有相关的基准测试才能帮助你选择合适的值.也许1或2是一个好的开始.
  68. </entry>
  69. </row>
  70. <row>
  71. <entry><code>hashed_directory_umask</code></entry>
  72. <entry><code>int</code></entry>
  73. <entry><code>0700</code></entry>
  74. <entry>
  75. 目录结构的Unix 掩码
  76. </entry>
  77. </row>
  78. <row>
  79. <entry><code>file_name_prefix</code></entry>
  80. <entry><code>string</code></entry>
  81. <entry><code>'zend_cache'</code></entry>
  82. <entry>
  83. 缓存文件前缀;小心使用此选项,因为当清除缓存时,在系统缓存目录(像 /tmp)中一个太generic的值将导致灾难.
  84. </entry>
  85. </row>
  86. <row>
  87. <entry><code>cache_file_umask</code></entry>
  88. <entry><code>int</code></entry>
  89. <entry><code>0700</code></entry>
  90. <entry>
  91. 缓存文件掩码
  92. </entry>
  93. </row>
  94. <row>
  95. <entry><code>metatadatas_array_max_size</code></entry>
  96. <entry><code>int</code></entry>
  97. <entry><code>100</code></entry>
  98. <entry>
  99. metadatas 数组的内部最大尺寸(除非你知道你在做什么,不要更改这个值)
  100. </entry>
  101. </row>
  102. </tbody>
  103. </tgroup>
  104. </table>
  105. </sect2>
  106. <sect2 id="zend.cache.backends.sqlite">
  107. <title>Zend_Cache_Backend_Sqlite</title>
  108. <para>
  109. 此后端把缓存纪录存储到SQLite数据库中.
  110. </para>
  111. <para>
  112. 可用的选项有:
  113. </para>
  114. <table id="zend.cache.backends.sqlite.table">
  115. <title>Sqlite 后端选项</title>
  116. <tgroup cols="4">
  117. <thead>
  118. <row>
  119. <entry>选项</entry>
  120. <entry>数据类型</entry>
  121. <entry>默认值</entry>
  122. <entry>描述</entry>
  123. </row>
  124. </thead>
  125. <tbody>
  126. <row>
  127. <entry><code>cache_db_complete_path (mandatory)</code></entry>
  128. <entry><code>string</code></entry>
  129. <entry><code>null</code></entry>
  130. <entry>
  131. SQLite数据库的完整和路径(包括文件名)
  132. </entry>
  133. </row>
  134. <row>
  135. <entry><code>automatic_vacuum_factor</code></entry>
  136. <entry><code>int</code></entry>
  137. <entry><code>10</code></entry>
  138. <entry>
  139. 禁用 / 调整自动清理过程. 自动清理过程将对数据库文件进行碎片整理(and make
  140. it smaller) 当clean() 或则 delete() 被调用时 : 0
  141. 表示不自动清理; 1 表示自动清理(当调用 delete() 或者 clean()
  142. 方法时) ; x (整数) > 1 => 当调用 delete() 或者 clean()
  143. 方法时随机清理1到x次.
  144. </entry>
  145. </row>
  146. </tbody>
  147. </tgroup>
  148. </table>
  149. </sect2>
  150. <sect2 id="zend.cache.backends.memcached">
  151. <title>Zend_Cache_Backend_Memcached</title>
  152. <para>
  153. 本后端把缓存纪录存储到memcached服务器. <ulink url="http://www.danga.com/memcached/">memcached</ulink>
  154. 是一个高性能的,分布式内存对象缓存系统.要使用此后端,你需要一个memecached守护进程(daemon)和
  155. <ulink url="http://pecl.php.net/package/memcache">memcache PECL 扩展</ulink>.
  156. </para>
  157. <para>
  158. 注意 : 使用此后端当设置"doNotTestCacheValidity=true"参数时,不支持"tags"
  159. </para>
  160. <para>
  161. 可用的选项有:
  162. </para>
  163. <table id="zend.cache.backends.memcached.table">
  164. <title>Memcached 后端选项</title>
  165. <tgroup cols="4">
  166. <thead>
  167. <row>
  168. <entry>选项</entry>
  169. <entry>数据类型</entry>
  170. <entry>默认值</entry>
  171. <entry>描述</entry>
  172. </row>
  173. </thead>
  174. <tbody>
  175. <row>
  176. <entry><code>servers</code></entry>
  177. <entry><code>array</code></entry>
  178. <entry><code>array(array('host' => 'localhost','port' => 11211, 'persistent' => true))</code></entry>
  179. <entry>
  180. 一个memcached服务器数组;其中每个memcached服务器描述为一个关联数组:
  181. 'host' => (string) : memcached服务器的名称, 'port'
  182. => (int) : memcached服务器端口, 'persistent' =>
  183. (bool) : 是否使用到memcached服务器的持久连接
  184. </entry>
  185. </row>
  186. <row>
  187. <entry><code>compression</code></entry>
  188. <entry><code>boolean</code></entry>
  189. <entry><code>false</code></entry>
  190. <entry>
  191. 如果你想使用数据压缩,设置为true
  192. </entry>
  193. </row>
  194. </tbody>
  195. </tgroup>
  196. </table>
  197. </sect2>
  198. <sect2 id="zend.cache.backends.apc">
  199. <title>Zend_Cache_Backend_Apc</title>
  200. <para>
  201. 此后端通过
  202. <ulink url="http://pecl.php.net/package/APC">APC</ulink>
  203. (Alternative PHP Cache) 扩展把缓存纪录存储于共享内存中 (当然为使用此后端,APC是需要的).
  204. </para>
  205. <para>
  206. 注意 : 使用此后端当设置"doNotTestCacheValidity=true"参数时,不支持"tags"
  207. </para>
  208. <para>
  209. 此后端没有选项.
  210. </para>
  211. </sect2>
  212. <sect2 id="zend.cache.backends.xcache">
  213. <title>Zend_Cache_Backend_Xcache</title>
  214. <para>
  215. 整个后端通过 <ulink url="http://xcache.lighttpd.net/">XCache</ulink> 扩展(它当然需要使用这个后端)
  216. 在共享内存里存储了缓存记录。
  217. </para>
  218. <para>
  219. 小心:用这个后端,目前不支持 ”tags“,因为 "doNotTestCacheValidity=true" 参数。
  220. </para>
  221. <para>
  222. 可用的选项如下:
  223. </para>
  224. <table id="zend.cache.backends.xcache.table">
  225. <title>Xcache backend 选项</title>
  226. <tgroup cols="4">
  227. <thead>
  228. <row>
  229. <entry>选项</entry>
  230. <entry>数据类型</entry>
  231. <entry>缺省值</entry>
  232. <entry>描述</entry>
  233. </row>
  234. </thead>
  235. <tbody>
  236. <row>
  237. <entry><code>user</code></entry>
  238. <entry><code>string</code></entry>
  239. <entry><code>null</code></entry>
  240. <entry>
  241. xcache.admin.user, necessary for the clean() method
  242. </entry>
  243. </row>
  244. <row>
  245. <entry><code>password</code></entry>
  246. <entry><code>string</code></entry>
  247. <entry><code>null</code></entry>
  248. <entry>
  249. xcache.admin.pass (in clear form, not MD5), necessary for the clean() method
  250. </entry>
  251. </row>
  252. </tbody>
  253. </tgroup>
  254. </table>
  255. </sect2>
  256. <sect2 id="zend.cache.backends.platform">
  257. <title>Zend_Cache_Backend_ZendPlatform</title>
  258. <para>
  259. 本后端使用 <ulink url="http://www.zend.com/products/platform">Zend Platform</ulink>产品的内容缓存API. 要使用此后端必须安装Zend Platform.
  260. </para>
  261. <para>
  262. 本后端支持标记(tags),但不支持 <code>CLEANING_MODE_NOT_MATCHING_TAG</code>清除模式.
  263. </para>
  264. <para>
  265. 当使用<code>Zend_Cache::factory()</code>方法时,在字 'Zend' 和 'Platform'之间使用字分隔符-- '-', '.', ' ', or '_'指定此后端:
  266. </para>
  267. <programlisting role="php"><![CDATA[
  268. $cache = Zend_Cache::factory('Core', 'Zend Platform');
  269. ]]>
  270. </programlisting>
  271. <para>
  272. 此后端没有选项.
  273. </para>
  274. </sect2>
  275. </sect1>
  276. <!--
  277. vim:se ts=4 sw=4 et:
  278. -->