<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.wincache.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'tr',
  ),
  'this' => 
  array (
    0 => 'function.wincache-ucache-set.php',
    1 => 'wincache_ucache_set',
    2 => 'Adds a variable in user cache and overwrites a variable if it already exists in the cache',
  ),
  'up' => 
  array (
    0 => 'ref.wincache.php',
    1 => 'WinCache İşlevleri',
  ),
  'prev' => 
  array (
    0 => 'function.wincache-ucache-meminfo.php',
    1 => 'wincache_ucache_meminfo',
  ),
  'next' => 
  array (
    0 => 'function.wincache-unlock.php',
    1 => 'wincache_unlock',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/wincache/functions/wincache-ucache-set.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.wincache-ucache-set" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">wincache_ucache_set</h1>
  <p class="verinfo">(PECL wincache &gt;= 1.1.0)</p><p class="refpurpose"><span class="refname">wincache_ucache_set</span> &mdash; <span class="dc-title">
   Adds a variable in user cache and overwrites a variable if it already exists in the cache
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.wincache-ucache-set-description">
  <h3 class="title">Açıklama</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>wincache_ucache_set</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</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">$value</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>wincache_ucache_set</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.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Adds a variable in user cache. Overwrites a variable if it already exists in the cache. 
   The added or updated variable remains in the user cache unless its time to live expires or it is 
   deleted by using <span class="function"><a href="function.wincache-ucache-delete.php" class="function">wincache_ucache_delete()</a></span> or <span class="function"><a href="function.wincache-ucache-clear.php" class="function">wincache_ucache_clear()</a></span> functions.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.wincache-ucache-set-parameters">
  <h3 class="title">Bağımsız Değişkenler</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">key</code></dt>
     <dd>
      <p class="para">
       Store the variable using this <code class="parameter">key</code> name. If a variable with same 
       <code class="parameter">key</code> is already present the function will overwrite the previous 
       value with the new one. <code class="parameter">key</code> is case sensitive. 
       <code class="parameter">key</code> can also take array of name =&gt; value pairs where names will be used as 
       keys. This can be used to add multiple values in the cache in one operation, thus avoiding 
       race condition.
      </p>
     </dd>
    
    
     <dt><code class="parameter">value</code></dt>
     <dd>
      <p class="para">
       Value of a variable to store. <code class="parameter">Value</code> supports all data types except resources, such as file handles.
       This parameter is ignored if first argument is an array. A general guidance is to pass <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>
       as <code class="parameter">value</code> while using array as <code class="parameter">key</code>. If <code class="parameter">value</code> is an
       object, or an array containing objects, then the objects will be serialized. See
       <a href="language.oop5.magic.php#object.sleep" class="link">__sleep()</a> for details on serializing objects.
      </p>
     </dd>
    
    
     <dt><code class="parameter">values</code></dt>
     <dd>
      <p class="para">
       Associative array of keys and values.
      </p>
     </dd>
    
    
     <dt><code class="parameter">ttl</code></dt>
     <dd>
      <p class="para">
       Time for the variable to live in the cache in seconds. After the value specified in <code class="parameter">ttl</code> has passed 
       the stored variable will be deleted from the cache. This parameter takes a default value of <code class="literal">0</code> which means 
       the variable will stay in the cache unless explicitly deleted by using <span class="function"><a href="function.wincache-ucache-delete.php" class="function">wincache_ucache_delete()</a></span> 
       or <span class="function"><a href="function.wincache-ucache-clear.php" class="function">wincache_ucache_clear()</a></span> functions.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.wincache-ucache-set-returnvalues">
  <h3 class="title">Dönen Değerler</h3>
  <p class="simpara">
   If <code class="parameter">key</code> is string, the function returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> on success and <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure.
  </p>
  <p class="para">
   If <code class="parameter">key</code> is an array, the function returns:
   <ul class="itemizedlist">
    <li class="listitem">
     <span class="simpara">
      If all the name =&gt; value pairs in the array can be set, function returns an empty array;
     </span>
    </li>
    <li class="listitem">
     <span class="simpara">
     If all the name =&gt; value pairs in the array cannot be set, function returns <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>;
     </span>
    </li>
    <li class="listitem">
     <span class="simpara">
      If some can be set while others cannot, function returns an array with name=&gt;value pair for which the addition failed in the user cache.
     </span>
    </li>
   </ul>
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.wincache-ucache-set-examples">
  <h3 class="title">Örnekler</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Örnek 1 <span class="function"><strong>wincache_ucache_set()</strong></span> with <code class="parameter">key</code> as a string</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">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">wincache_ucache_set</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">wincache_ucache_get</span><span style="color: #007700">(</span><span style="color: #DD0000">'foo'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$bar1 </span><span style="color: #007700">= </span><span style="color: #DD0000">'BAR1'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">wincache_ucache_set</span><span style="color: #007700">(</span><span style="color: #DD0000">'foo'</span><span style="color: #007700">, </span><span style="color: #0000BB">$bar1</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">wincache_ucache_get</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>
Yukarıdaki örneğin çıktısı:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">bool(true)
string(3) &quot;BAR&quot;
bool(true)
string(3) &quot;BAR1&quot;</pre>
</div>
    </div>    
   </div>
  </p>
  <p class="para">
   <div class="example" id="example-2">
    <p><strong>Örnek 2 <span class="function"><strong>wincache_ucache_set()</strong></span> with <code class="parameter">key</code> as an array</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$colors_array </span><span style="color: #007700">= array(</span><span style="color: #DD0000">'green' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'5'</span><span style="color: #007700">, </span><span style="color: #DD0000">'Blue' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'6'</span><span style="color: #007700">, </span><span style="color: #DD0000">'yellow' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'7'</span><span style="color: #007700">, </span><span style="color: #DD0000">'cyan' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'8'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">wincache_ucache_set</span><span style="color: #007700">(</span><span style="color: #0000BB">$colors_array</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">wincache_ucache_set</span><span style="color: #007700">(</span><span style="color: #0000BB">$colors_array</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">wincache_ucache_get</span><span style="color: #007700">(</span><span style="color: #DD0000">'Blue'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>
Yukarıdaki örneğin çıktısı:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">array(0) {}
array(0) {}
string(1) &quot;6&quot;</pre>
</div>
    </div>    
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.wincache-ucache-set-seealso">
  <h3 class="title">Ayrıca Bakınız</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.wincache-ucache-add.php" class="function" rel="rdfs-seeAlso">wincache_ucache_add()</a> - Adds a variable in user cache only if variable does not already exist in the cache</span></li>
    <li><span class="function"><a href="function.wincache-ucache-get.php" class="function" rel="rdfs-seeAlso">wincache_ucache_get()</a> - Gets a variable stored in the user cache</span></li>
    <li><span class="function"><a href="function.wincache-ucache-delete.php" class="function" rel="rdfs-seeAlso">wincache_ucache_delete()</a> - Deletes variables from the user cache</span></li>
    <li><span class="function"><a href="function.wincache-ucache-clear.php" class="function" rel="rdfs-seeAlso">wincache_ucache_clear()</a> - Deletes entire content of the user cache</span></li>
    <li><span class="function"><a href="function.wincache-ucache-exists.php" class="function" rel="rdfs-seeAlso">wincache_ucache_exists()</a> - Checks if a variable exists in the user cache</span></li>
    <li><span class="function"><a href="function.wincache-ucache-meminfo.php" class="function" rel="rdfs-seeAlso">wincache_ucache_meminfo()</a> - Retrieves information about user cache memory usage</span></li>
    <li><span class="function"><a href="function.wincache-ucache-info.php" class="function" rel="rdfs-seeAlso">wincache_ucache_info()</a> - Retrieves information about data stored in the user cache</span></li>
    <li><a href="language.oop5.magic.php#object.sleep" class="link">__sleep()</a></li>
   </ul>
  </p>
 </div>


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