<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.memcached.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'memcached.casbykey.php',
    1 => 'Memcached::casByKey',
    2 => 'Compare and swap an item on a specific server',
  ),
  'up' => 
  array (
    0 => 'class.memcached.php',
    1 => 'Memcached',
  ),
  'prev' => 
  array (
    0 => 'memcached.cas.php',
    1 => 'Memcached::cas',
  ),
  'next' => 
  array (
    0 => 'memcached.construct.php',
    1 => 'Memcached::__construct',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/memcached/memcached/casbykey.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="memcached.casbykey" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Memcached::casByKey</h1>
  <p class="verinfo">(PECL memcached &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">Memcached::casByKey</span> &mdash; <span class="dc-title">Compare and swap an item on a specific server</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-memcached.casbykey-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>Memcached::casByKey</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.float.php" class="type float">float</a></span></span> <code class="parameter">$cas_token</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$server_key</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$key</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$value</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$expiration</code><span class="initializer"> = 0</span></span><br>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>Memcached::casByKey()</strong></span> is functionally equivalent to
   <span class="methodname"><a href="memcached.cas.php" class="methodname">Memcached::cas()</a></span>, except that the free-form
   <code class="parameter">server_key</code> can be used to map the
   <code class="parameter">key</code> to a specific server. This is useful if you need
   to keep a bunch of related keys on a certain server.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-memcached.casbykey-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">cas_token</code></dt>
     <dd>
      <p class="para">
       Unique value associated with the existing item. Generated by memcache.
      </p>
     </dd>
    
    
     <dt><code class="parameter">server_key</code></dt>
     <dd>
      <p class="para">
       The key identifying the server to store the value on or retrieve it from. Instead of hashing on the actual key for the item, we hash on the server key when deciding which memcached server to talk to. This allows related items to be grouped together on a single server for efficiency with multi operations.
      </p>
     </dd>
    
    
     <dt><code class="parameter">key</code></dt>
     <dd>
      <p class="para">
       The key under which to store the value.
      </p>
     </dd>
    
    
     <dt><code class="parameter">value</code></dt>
     <dd>
      <p class="para">
       The value to store.
      </p>
     </dd>
    
    
     <dt><code class="parameter">expiration</code></dt>
     <dd>
      <p class="para">
       The expiration time, defaults to 0. See <a href="memcached.expiration.php" class="link">Expiration Times</a> for more info.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-memcached.casbykey-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> on success or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure.
   The <span class="methodname"><a href="memcached.getresultcode.php" class="methodname">Memcached::getResultCode()</a></span> will return
   <strong><code><a href="memcached.constants.php#memcached.constants.res-data-exists">Memcached::RES_DATA_EXISTS</a></code></strong> if the item you are trying
   to store has been modified since you last fetched it.
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-memcached.casbykey-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="memcached.cas.php" class="methodname" rel="rdfs-seeAlso">Memcached::cas()</a> - Compare and swap an item</span></li>
   </ul>
  </p>
 </div>


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