<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.yac.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'yac.info.php',
    1 => 'Yac::info',
    2 => 'Status of cache',
  ),
  'up' => 
  array (
    0 => 'class.yac.php',
    1 => 'Yac',
  ),
  'prev' => 
  array (
    0 => 'yac.getter.php',
    1 => 'Yac::__get',
  ),
  'next' => 
  array (
    0 => 'yac.set.php',
    1 => 'Yac::set',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/yac/yac/info.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="yac.info" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Yac::info</h1>
  <p class="verinfo">(PECL yac &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">Yac::info</span> &mdash; <span class="dc-title">Status of cache</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-yac.info-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">function</span> <span class="methodname"><strong>Yac::info</strong></span>(): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>

  <p class="simpara">
    Get status of cache system
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-yac.info-parameters">
  <h3 class="title">Parameters</h3>
  <p class="simpara">This function has no parameters.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-yac.info-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="simpara">
   Returns an <span class="type"><a href="language.types.array.php" class="type array">array</a></span> with the following keys:
  </p>
  <dl>
   
    <dt><code class="literal">memory_size</code></dt>
    <dd><p class="simpara">
     Total shared memory in use, in bytes: the slot table plus the value
     blocks.
    </p></dd>
   
   
    <dt><code class="literal">slots_memory_size</code></dt>
    <dd><p class="simpara">
     Memory reserved for the hash slot table, in bytes.
    </p></dd>
   
   
    <dt><code class="literal">values_memory_size</code></dt>
    <dd><p class="simpara">
     Memory reserved for the stored values, in bytes.
    </p></dd>
   
   
    <dt><code class="literal">segment_size</code></dt>
    <dd><p class="simpara">
     Size of one value memory segment, in bytes.
    </p></dd>
   
   
    <dt><code class="literal">segment_num</code></dt>
    <dd><p class="simpara">
     Number of value memory segments.
    </p></dd>
   
   
    <dt><code class="literal">miss</code></dt>
    <dd><p class="simpara">
     Number of cache misses: lookups that found nothing or an expired
     entry.
    </p></dd>
   
   
    <dt><code class="literal">hits</code></dt>
    <dd><p class="simpara">
     Number of cache hits: successful lookups.
    </p></dd>
   
   
    <dt><code class="literal">fails</code></dt>
    <dd><p class="simpara">
     Number of failed stores: stores that could not allocate a value
     block.
    </p></dd>
   
   
    <dt><code class="literal">kicks</code></dt>
    <dd><p class="simpara">
     Number of evictions: how often an existing entry had to be evicted
     because the candidate slot path was full.
    </p></dd>
   
   
    <dt><code class="literal">recycles</code></dt>
    <dd><p class="simpara">
     Number of times the allocator reached the end of a segment and
     wrapped around to its beginning.
    </p></dd>
   
   
    <dt><code class="literal">start_time</code></dt>
    <dd><p class="simpara">
     The Unix timestamp at which the shared memory cache was initialized.
    </p></dd>
   
   
    <dt><code class="literal">slots_size</code></dt>
    <dd><p class="simpara">
     Total number of hash slots.
    </p></dd>
   
   
    <dt><code class="literal">slots_used</code></dt>
    <dd><p class="simpara">
     Number of hash slots currently occupied.
    </p></dd>
   
  </dl>
 </div>


 <div class="refsect1 examples" id="refsect1-yac.info-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-1">
   <p><strong>Example #1 <span class="methodname"><strong>Yac::info()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
$yac </span><span style="color: #007700">= new </span><span style="color: #0000BB">Yac</span><span style="color: #007700">();
</span><span style="color: #0000BB">$yac</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">set</span><span style="color: #007700">(</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">, </span><span style="color: #DD0000">"bar"</span><span style="color: #007700">);

</span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$yac</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">info</span><span style="color: #007700">());
</span><span style="color: #0000BB">?&gt;</span></code></pre></div>
   </div>

   <div class="example-contents"><p>The above example will output
something similar to:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Array
(
    [memory_size] =&gt; 75497472
    [slots_memory_size] =&gt; 8388608
    [values_memory_size] =&gt; 67108864
    [segment_size] =&gt; 4194304
    [segment_num] =&gt; 16
    [miss] =&gt; 0
    [hits] =&gt; 0
    [fails] =&gt; 0
    [kicks] =&gt; 0
    [recycles] =&gt; 0
    [start_time] =&gt; 1725955200
    [slots_size] =&gt; 65536
    [slots_used] =&gt; 1
)</pre>
</div>
   </div>
   <div class="example-contents"><p>
    The hit ratio can be computed as <code class="literal">hits / (hits + miss)</code>;
    a growing <code class="literal">kicks</code> or <code class="literal">fails</code> counter
    indicates that the cache is under memory pressure.
   </p></div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-yac.info-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="yac.dump.php" class="methodname" rel="rdfs-seeAlso">Yac::dump()</a> - Dump cache entries for inspection</span></li>
   </ul>
  </p>
 </div>


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