<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.apcu.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.apcu-store.php',
    1 => 'apcu_store',
    2 => 'Cache a variable in the data store',
  ),
  'up' => 
  array (
    0 => 'ref.apcu.php',
    1 => 'APCu Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.apcu-sma-info.php',
    1 => 'apcu_sma_info',
  ),
  'next' => 
  array (
    0 => 'class.apcuiterator.php',
    1 => 'APCUIterator',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/apcu/functions/apcu-store.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.apcu-store" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">apcu_store</h1>
  <p class="verinfo">(PECL apcu &gt;= 4.0.0)</p><p class="refpurpose"><span class="refname">apcu_store</span> &mdash; <span class="dc-title">
   Cache a variable in the data store
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.apcu-store-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>apcu_store</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$key</code></span>, <span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$var</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$ttl</code><span class="initializer"> = 0</span></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <div class="methodsynopsis dc-description"><span class="methodname"><strong>apcu_store</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$values</code></span>, <span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$unused</code><span class="initializer"> = NULL</span></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$ttl</code><span class="initializer"> = 0</span></span>): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>

  <p class="simpara">
   Cache a variable in the data store.
  </p>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <span class="simpara">
    Unlike many other mechanisms in PHP, variables stored using
    <span class="function"><strong>apcu_store()</strong></span> will persist between requests (until the
    value is removed from the cache).
   </span>
  </p></blockquote>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.apcu-store-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <dl>
   
    <dt><code class="parameter">key</code></dt>
    <dd>
     <span class="simpara">
      Store the variable using this name. <code class="parameter">key</code>s are
      cache-unique, so storing a second value with the same
      <code class="parameter">key</code> will overwrite the original value.
     </span>
    </dd>
   
   
    <dt><code class="parameter">var</code></dt>
    <dd>
     <span class="simpara">
      The variable to store
     </span>
    </dd>
   
   
    <dt><code class="parameter">ttl</code></dt>
    <dd>
     <span class="simpara">
      Time To Live; store <code class="parameter">var</code> in the cache for
      <code class="parameter">ttl</code> seconds. After the
      <code class="parameter">ttl</code> has passed, the stored variable will be
      expunged from the cache (on the next request). If no <code class="parameter">ttl</code>
      is supplied (or if the <code class="parameter">ttl</code> is
      <code class="literal">0</code>), the value will persist until it is removed from
      the cache manually, or otherwise fails to exist in the cache (clear,
      restart, etc.).
     </span>
    </dd>
   
   
    <dt><code class="parameter">values</code></dt>
    <dd>
     <span class="simpara">
      Names in key, variables in value.
     </span>
    </dd>
   
  </dl>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.apcu-store-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="simpara">
   Restituisce <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> in caso di successo, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> in caso di fallimento.
   Second syntax returns array with error keys.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.apcu-store-examples">
  <h3 class="title">Esempi</h3>
  <div class="example" id="example-1">
   <p><strong>Example #1 A <span class="function"><strong>apcu_store()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$bar </span><span style="color: #007700">= </span><span style="color: #DD0000">'BAR'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">apcu_store</span><span style="color: #007700">(</span><span style="color: #DD0000">'foo'</span><span style="color: #007700">, </span><span style="color: #0000BB">$bar</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">apcu_fetch</span><span style="color: #007700">(</span><span style="color: #DD0000">'foo'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Il precedente esempio visualizzerà:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">string(3) &quot;BAR&quot;</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.apcu-store-seealso">
  <h3 class="title">Vedere anche:</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.apcu-add.php" class="function" rel="rdfs-seeAlso">apcu_add()</a> - Cache a new variable in the data store</span></li>
   <li><span class="function"><a href="function.apcu-fetch.php" class="function" rel="rdfs-seeAlso">apcu_fetch()</a> - Fetch a stored variable from the cache</span></li>
   <li><span class="function"><a href="function.apcu-delete.php" class="function" rel="rdfs-seeAlso">apcu_delete()</a> - Removes a stored variable from the cache</span></li>
  </ul>
 </div>


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