Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 9147

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Compare and swap an item on a specific server</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="memcached.cas.html">Memcached::cas</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="memcached.construct.html">Memcached::__construct</a></div>
 <div class="up"><a href="class.memcached.html">Memcached</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><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="type">bool</span> <span class="methodname"><strong>Memcached::casByKey</strong></span>
    ( <span class="methodparam"><span class="type">float</span> <code class="parameter">$cas_token</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$server_key</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$key</code></span>
   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$value</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$expiration</code></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.html" class="methodname">Memcached::cas()</a></span>, except that the free-form
   <em><code class="parameter">server_key</code></em> can be used to map the
   <em><code class="parameter">key</code></em> 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>

     <span class="term"><em><code class="parameter">cas_token</code></em></span>
     <dd>

      <p class="para">
       Unique value associated with the existing item. Generated by memcache.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">server_key</code></em></span>
     <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>

    <dt>

     <span class="term"><em><code class="parameter">key</code></em></span>
     <dd>

      <p class="para">
       The key under which to store the value.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">value</code></em></span>
     <dd>

      <p class="para">
       The value to store.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">expiration</code></em></span>
     <dd>

      <p class="para">
       The expiration time, defaults to 0. See <a href="memcached.expiration.html" class="link">Expiration Times</a> for more info.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-memcached.casbykey-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure.
   The  <span class="methodname"><a href="memcached.getresultcode.html" class="methodname">Memcached::getResultCode()</a></span> will return
   <strong><code>Memcached::RES_DATA_EXISTS</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 class="member"> <span class="methodname"><a href="memcached.cas.html" class="methodname" rel="rdfs-seeAlso">Memcached::cas()</a> - Compare and swap an item</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="memcached.cas.html">Memcached::cas</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="memcached.construct.html">Memcached::__construct</a></div>
 <div class="up"><a href="class.memcached.html">Memcached</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>