<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/yac.setup.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'yac.configuration.php',
    1 => '运行时配置',
    2 => '运行时配置',
  ),
  'up' => 
  array (
    0 => 'yac.setup.php',
    1 => '安装/配置',
  ),
  'prev' => 
  array (
    0 => 'yac.installation.php',
    1 => '安装',
  ),
  'next' => 
  array (
    0 => 'yac.resources.php',
    1 => '资源类型',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/yac/ini.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="yac.configuration" class="section">
 <h2 class="title">运行时配置</h2>
 <p class="simpara">
这些函数的行为受 <var class="filename">php.ini</var> 中的设置影响。
</p>
 <p class="para">
  <table class="doctable table">
   <caption><strong>Yac 配置选项</strong></caption>
   
    <thead>
     <tr>
      <th>名字</th>
      <th>默认</th>
      <th>可修改范围</th>
      <th>更新日志</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td><a href="yac.configuration.php#ini.yac.compress-threshold" class="link">yac.compress_threshold</a></td>
      <td>4K</td>
      <td><strong><code><a href="info.constants.php#constant.ini-system">INI_SYSTEM</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="yac.configuration.php#ini.yac.debug" class="link">yac.debug</a></td>
      <td>0</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="yac.configuration.php#ini.yac.enable" class="link">yac.enable</a></td>
      <td>1</td>
      <td><strong><code><a href="info.constants.php#constant.ini-system">INI_SYSTEM</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="yac.configuration.php#ini.yac.enable-cli" class="link">yac.enable_cli</a></td>
      <td>0</td>
      <td><strong><code><a href="info.constants.php#constant.ini-system">INI_SYSTEM</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="yac.configuration.php#ini.yac.keys-memory-size" class="link">yac.keys_memory_size</a></td>
      <td>8M</td>
      <td><strong><code><a href="info.constants.php#constant.ini-system">INI_SYSTEM</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="yac.configuration.php#ini.yac.serializer" class="link">yac.serializer</a></td>
      <td>php</td>
      <td><strong><code><a href="info.constants.php#constant.ini-system">INI_SYSTEM</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="yac.configuration.php#ini.yac.values-memory-size" class="link">yac.values_memory_size</a></td>
      <td>64M</td>
      <td><strong><code><a href="info.constants.php#constant.ini-system">INI_SYSTEM</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

    </tbody>
   
  </table>

 </p>

 <p class="simpara">这是配置指令的简短说明。</p>

 <p class="para">
  <dl>
   
     <dt id="ini.yac.compress-threshold">
      <code class="parameter">yac.compress_threshold</code>
      <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
     </dt>
     <dd>
      <p class="simpara">
       序列化后大于该字节数的值会在存储前被压缩（自 Yac 2.4.0 起使用 LZ4）。超过
       <code class="literal">1M</code> 存储条目上限（<strong><code><a href="yac.constants.php#constant.yac-max-raw-compressed-len">YAC_MAX_RAW_COMPRESSED_LEN</a></code></strong>）的值无论本设置如何都会被压缩，因为它们无法以未压缩形式存储。默认值 <code class="literal">4K</code> 表示开启压缩；
       <code class="literal">-1</code> 对低于存储条目上限的值禁用压缩；其他正值会被钳制到 <code class="literal">1024</code>..<code class="literal">1M</code>
       区间内。压缩大值可以节省共享内存，代价是存取时多消耗一些 CPU。
      </p>
     </dd>
    
    
     <dt id="ini.yac.debug">
      <code class="parameter">yac.debug</code>
      <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
     </dt>
     <dd>
      <p class="simpara">
       保留给调试用。截至 Yac 2.4.0，该配置项已注册但没有任何效果。
      </p>
     </dd>
    
    
     <dt id="ini.yac.enable">
      <code class="parameter">yac.enable</code>
      <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
     </dt>
     <dd>
      <p class="simpara">
       是否启用 Yac。如果被禁用，创建
       <span class="classname"><a href="class.yac.php" class="classname">Yac</a></span> 实例会抛出异常。
      </p>
     </dd>
    
    
     <dt id="ini.yac.enable-cli">
      <code class="parameter">yac.enable_cli</code>
      <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
     </dt>
     <dd>
      <p class="simpara">
       在 <code class="literal">CLI</code> SAPI 下运行时是否启用 Yac。默认禁用，因为命令行脚本通常启动后立即结束，创建共享内存段毫无意义。
      </p>
     </dd>
    
    
     <dt id="ini.yac.keys-memory-size">
      <code class="parameter">yac.keys_memory_size</code>
      <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
     </dt>
     <dd>
      <p class="simpara">
       用于存放键表的共享内存大小。它限制了能同时存在的条目数量——默认的 <code class="literal">8M</code> 大约能容纳 65,536 个条目。如果命中率下降且 <code class="literal">kicks</code> 攀升，请调大该值；关于键表写满后的行为以及何时才真正构成问题，参见<a href="yac.memory-management.php" class="xref">内存管理</a>。
      </p>
     </dd>
    
    
     <dt id="ini.yac.serializer">
      <code class="parameter">yac.serializer</code>
      <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
     </dt>
     <dd>
      <p class="simpara">
       存储前把任意 PHP 值转换成字节序列所用的序列化器。可选值为 <code class="literal">php</code>（默认）、<code class="literal">json</code>、
       <code class="literal">igbinary</code> 和 <code class="literal">msgpack</code>。后三者需要扩展以相应支持编译。
       <code class="literal">igbinary</code> 和 <code class="literal">msgpack</code>
       等二进制序列化器通常比 <code class="literal">php</code> 更快，产生的数据也更小。
      </p>
     </dd>
    
    
     <dt id="ini.yac.values-memory-size">
      <code class="parameter">yac.values_memory_size</code>
      <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
     </dt>
     <dd>
      <p class="simpara">
       用于存放值的共享内存大小。值在一个个 4M 的段上，由一个只进不退的分配器（bump allocator）分配；当没有任何段装得下新值时，分配器游标会绕回起点，最旧的值会被悄悄覆盖（即一次回收，
       <code class="literal">recycle</code>）。此后对它们的读取会退化为未命中，由一个完整性校验机制检出。如果在槽位尚有余量时 <code class="literal">recycles</code> 仍在攀升，请调大该值；或者启用
       <a href="yac.configuration.php#ini.yac.compress-threshold" class="link">yac.compress_threshold</a>
       来压缩大载荷。参见<a href="yac.memory-management.php" class="xref">内存管理</a>。
      </p>
     </dd>
    

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