Source of: /manual/en/function.memcache-getserverstatus.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.memcache.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'function.memcache-getserverstatus.php',
1 => 'Memcache::getServerStatus',
),
'up' =>
array (
0 => 'ref.memcache.php',
1 => 'Memcache Functions',
),
'prev' =>
array (
0 => 'function.memcache-getextendedstats.php',
1 => 'Memcache::getExtendedStats',
),
'next' =>
array (
0 => 'function.memcache-getstats.php',
1 => 'Memcache::getStats',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="function.memcache-getserverstatus" class="refentry">
<div class="refnamediv">
<h1 class="refname">Memcache::getServerStatus</h1>
<p class="verinfo">(PECL memcache >= 2.1.0)</p><p class="refpurpose"><span class="refname">Memcache::getServerStatus</span> — <span class="dc-title">Returns server status</span></p>
</div>
<a name="function.memcache-getserverstatus.description"></a><div class="refsect1 description">
<h3 class="title">Description</h3>
<div class="methodsynopsis dc-description">
<span class="type">int</span> <span class="methodname"><b>Memcache::getServerStatus</b></span>
( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$host</tt></span>
[, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$port</tt></span>
] )</div>
<p class="para rdfs-comment">
<b>Memcache::getServerStatus()</b> returns a the servers
online/offline status. You can also use <b>memcache_get_server_status()</b>
function.
</p>
<blockquote><p><b class="note">Note</b>:
This function has been added to Memcache version 2.1.0.
<br />
</p></blockquote>
</div>
<a name="function.memcache-getserverstatus.parameters"></a><div class="refsect1 parameters">
<h3 class="title">Parameters</h3>
<p class="para">
</p><dl>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">host</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
Point to the host where memcached is listening for connections.
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">port</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
Point to the port where memcached is listening for connections.
This parameter is optional and its default value is 11211.
</p>
</dd>
</dl>
<p>
</p>
</div>
<a name="function.memcache-getserverstatus.returnvalues"></a><div class="refsect1 returnvalues">
<h3 class="title">Return Values</h3>
<p class="para">
Returns a the servers status. 0 if server is failed, non-zero otherwise
</p>
</div>
<a name="function.memcache-getserverstatus.examples"></a><div class="refsect1 examples">
<h3 class="title">Examples</h3>
<p class="para">
</p><div class="example">
<p><b>Example #1 <b>Memcache::getServerStatus()</b> example</b></p>
<div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB"><?php<br /><br /></span><span style="color: #FF8000">/* OO API */<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 /></span><span style="color: #0000BB">$memcache</span><span style="color: #007700">-></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">);<br />echo </span><span style="color: #0000BB">$memcache</span><span style="color: #007700">-></span><span style="color: #0000BB">getServerStatus</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 /><br /></span><span style="color: #FF8000">/* procedural API */<br /></span><span style="color: #0000BB">$memcache </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 />echo </span><span style="color: #0000BB">memcache_get_server_status</span><span style="color: #007700">(</span><span style="color: #0000BB">$memcache</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 /><br /></span><span style="color: #0000BB">?></span>
</span>
</code></div>
</div>
</div><p>
</p>
</div>
<a name="function.memcache-getserverstatus.seealso"></a><div class="refsect1 seealso">
<h3 class="title">See Also</h3>
<p class="para">
</p><ul class="simplelist">
<li class="member"><a href="function.memcache-addserver.php" class="function" rel="rdfs-seeAlso">Memcache::addServer()</a> - Add a memcached server to connection pool</li>
<li class="member"><a href="function.memcache-setserverparams.php" class="function" rel="rdfs-seeAlso">Memcache::setServerParams()</a> - Changes server parameters and status at runtime</li>
</ul><p>
</p>
</div>
</div><?php manual_footer(); ?>