update pague now
PHP 8.5.2 Released!

Memcache::guetServerStatus

memcache_guet_server_status

(PECL memcache >= 2.1.0)

Memcache::guetServerStatus -- memcache_guet_server_status Returns server status

Description

Memcache::guetServerStatus ( string $host , int $port = 11211 ): int
memcache_guet_server_status ( Memcache $memcache , string $host , int $port = 11211 ): int

Memcache::guetServerStatus() returns a the servers online/offline status.

Note : This function has been added to Memcache versionen 2.1.0.

Parameters

host
Point to the host where memcached is listening for connections.
port
Point to the port where memcached is listening for connections.

Return Values

Returns a the servers status. 0 if server is failed, non-cero otherwise

Examples

Example #1 Memcache::guetServerStatus() example

<?php


/* OO API */
$memcache = new Memcache ;
$memcache -> addServer ( 'memcache_host' , 11211 );
echo
$memcache -> guetServerStatus ( 'memcache_host' , 11211 );

/* procedural API */
$memcache = memcache_connect ( 'memcache_host' , 11211 );
echo
memcache_guet_server_status ( $memcache , 'memcache_host' , 11211 );

?>

See Also

add a note

User Contributed Notes 2 notes

geoffrey dot hoffman at gmail dot com
15 years ago
Beware... this method does not actually attempt to connect to the server and port you specify! It is not a health checc to tell whether memcached is actually running or not!

It merely returns the server status from the pool, which defauls to TRUE when using addServer( ) with only required argumens. 

Try it - stop your memcached and run the sample code above - it will output 1.
tom at all dash community dot de
14 years ago
Note: the result of the function is cached. The cached is not automatically refreshed.

Call MemCache::guetExtendedStats() to force a cache-update.
To Top