PHP memcache - check if any server is available in pool?

Posted by Industrial on Stack Overflow See other posts from Stack Overflow or by Industrial
Published on 2010-05-23T13:23:52Z Indexed on 2010/05/23 13:31 UTC
Read the original article Hit count: 168

Filed under:
|
|
|

Hi everyone,

I have the following code:

$cluster['local'] = array('host' => '192.168.1.1', 'port' => '11211', 'weight' => 50);
$cluster['local2'] = array('host' => '192.168.1.2', 'port' => '11211', 'weight' => 50);

$this->memcache = new Memcache;

foreach ($this->cluster() as $cluster) {
    $this->memcache->addServer($cluster['host'], $cluster['port'], $this->persistent, $cluster['weight'], 10, 10, TRUE , 'failure' );
}

I would like to make a function that checks if any of my servers in my memcache Pool is available. How could this be done?

© Stack Overflow or respective owner

Related posts about php

Related posts about memcached