<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.memcache.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'memcache.setserverparams.php',
    1 => 'Memcache::setServerParams',
    2 => 'Changes server parameters and status at runtime',
  ),
  'up' => 
  array (
    0 => 'class.memcache.php',
    1 => 'Memcache',
  ),
  'prev' => 
  array (
    0 => 'memcache.setcompressthreshold.php',
    1 => 'Memcache::setCompressThreshold',
  ),
  'next' => 
  array (
    0 => 'ref.memcache.php',
    1 => 'Memcache Funktionen',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/memcache/memcache/setserverparams.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="memcache.setserverparams" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Memcache::setServerParams</h1>
  <h1 class="refname">memcache_set_server_params</h1>
  <p class="verinfo">(PECL memcache &gt;= 2.1.0)</p><p class="refpurpose"><span class="refname">Memcache::setServerParams</span> -- <span class="refname">memcache_set_server_params</span> &mdash; <span class="dc-title">Changes server parameters and status at runtime</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-memcache.setserverparams-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>Memcache::setServerParams</strong></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">$host</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">$port</code><span class="initializer"> = 11211</span></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">$timeout</code><span class="initializer"> = ?</span></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">$retry_interval</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$status</code><span class="initializer"> = ?</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$failure_callback</code><span class="initializer"> = ?</span></span><br>): <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>memcache_set_server_params</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="class.memcache.php" class="type Memcache">Memcache</a></span> <code class="parameter">$memcache</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">$host</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">$port</code><span class="initializer"> = 11211</span></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">$timeout</code><span class="initializer"> = ?</span></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">$retry_interval</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$status</code><span class="initializer"> = ?</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$failure_callback</code><span class="initializer"> = ?</span></span><br>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>


  <p class="simpara">
   <span class="function"><strong>Memcache::setServerParams()</strong></span> changes server parameters at runtime.
  </p>

  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <span class="simpara">
    This function has been added to Memcache version 2.1.0.
   </span>
  </p></blockquote>

 </div>


 <div class="refsect1 parameters" id="refsect1-memcache.setserverparams-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <dl>
   
    <dt><code class="parameter">host</code></dt>
    <dd>
     <span class="simpara">
      Point to the host where memcached is listening for connections.
     </span>
    </dd>
   
   
    <dt><code class="parameter">port</code></dt>
    <dd>
     <span class="simpara">
      Point to the port where memcached is listening for connections.
     </span>
    </dd>
   
   
    <dt><code class="parameter">timeout</code></dt>
    <dd>
     <span class="simpara">
      Value in seconds which will be used for connecting to the daemon. Think
      twice before changing the default value of 1 second - you can lose all
      the advantages of caching if your connection is too slow.
     </span>
    </dd>
   
   
    <dt><code class="parameter">retry_interval</code></dt>
    <dd>
     <span class="simpara">
      Controls how often a failed server will be retried, the default value
      is 15 seconds. Setting this parameter to -1 disables automatic retry.
      Neither this nor the <code class="parameter">persistent</code> parameter has any
      effect when the extension is loaded dynamically via <span class="function"><a href="function.dl.php" class="function">dl()</a></span>.
     </span>
    </dd>
   
   
    <dt><code class="parameter">status</code></dt>
    <dd>
     <span class="simpara">
      Controls if the server should be flagged as online. Setting this parameter
      to <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> and <code class="parameter">retry_interval</code> to -1 allows a failed
      server to be kept in the pool so as not to affect the key distribution
      algorithm. Requests for this server will then failover or fail immediately
      depending on the <code class="parameter">memcache.allow_failover</code> setting.
      Default to <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, meaning the server should be considered online.
     </span>
    </dd>
   
   
    <dt><code class="parameter">failure_callback</code></dt>
    <dd>
     <span class="simpara">
      Allows the user to specify a callback function to run upon encountering an
      error. The callback is run before failover is attempted. The function takes
      two parameters, the hostname and port of the failed server.
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-memcache.setserverparams-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="simpara">
   Gibt bei Erfolg <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> zurück. Bei einem Fehler wird <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurückgegeben.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-memcache.setserverparams-examples">
  <h3 class="title">Beispiele</h3>
  <div class="example" id="example-1">
   <p><strong>Beispiel #1 <span class="function"><strong>Memcache::setServerParams()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #007700">function </span><span style="color: #0000BB">_callback_memcache_failure</span><span style="color: #007700">(</span><span style="color: #0000BB">$host</span><span style="color: #007700">, </span><span style="color: #0000BB">$port</span><span style="color: #007700">) {<br />    print </span><span style="color: #DD0000">"memcache '</span><span style="color: #0000BB">$host</span><span style="color: #DD0000">:</span><span style="color: #0000BB">$port</span><span style="color: #DD0000">' failed"</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #FF8000">/* OO API */<br /><br /></span><span style="color: #0000BB">$memcache </span><span style="color: #007700">= new </span><span style="color: #0000BB">Memcache</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// Add the server in offline mode<br /></span><span style="color: #0000BB">$memcache</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addServer</span><span style="color: #007700">(</span><span style="color: #DD0000">'memcache_host'</span><span style="color: #007700">, </span><span style="color: #0000BB">11211</span><span style="color: #007700">, </span><span style="color: #0000BB">false</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">, -</span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">false</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Bring the server back online<br /></span><span style="color: #0000BB">$memcache</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setServerParams</span><span style="color: #007700">(</span><span style="color: #DD0000">'memcache_host'</span><span style="color: #007700">, </span><span style="color: #0000BB">11211</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">15</span><span style="color: #007700">, </span><span style="color: #0000BB">true</span><span style="color: #007700">, </span><span style="color: #DD0000">'_callback_memcache_failure'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/* procedural API */<br /><br /></span><span style="color: #0000BB">$memcache_obj </span><span style="color: #007700">= </span><span style="color: #0000BB">memcache_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'memcache_host'</span><span style="color: #007700">, </span><span style="color: #0000BB">11211</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">memcache_set_server_params</span><span style="color: #007700">(</span><span style="color: #0000BB">$memcache_obj</span><span style="color: #007700">, </span><span style="color: #DD0000">'memcache_host'</span><span style="color: #007700">, </span><span style="color: #0000BB">11211</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">15</span><span style="color: #007700">, </span><span style="color: #0000BB">true</span><span style="color: #007700">, </span><span style="color: #DD0000">'_callback_memcache_failure'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-memcache.setserverparams-seealso">
  <h3 class="title">Siehe auch</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="memcache.addserver.php" class="function" rel="rdfs-seeAlso">Memcache::addServer()</a> - Add a memcached server to connection pool</span></li>
   <li><span class="function"><a href="memcache.getserverstatus.php" class="function" rel="rdfs-seeAlso">Memcache::getServerStatus()</a> - Returns server status</span></li>
  </ul>
 </div>


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