phpday 2027 - Call for Papers

Memcached::getServerList

(PECL memcached >= 0.1.0)

Memcached::getServerList — Liste les serveurs du pool memcached

Description

public function Memcached::getServerList(): array

Memcached::getServerList() retourne la liste de tous les serveurs qui sont dans sa liste.

Liste de paramètres

Cette fonction ne contient aucun paramètre.

Valeurs de retour

La liste de tous les serveurs du pool.

Exemples

Exemple #1 Exemple avec Memcached::getServerList()

<?php
$m = new Memcached();
$m->addServers(array(
    array('mem1.domain.com', 11211, 20),
    array('mem2.domain.com', 11311, 80),
));
var_dump($m->getServerList());
?>

L'exemple ci-dessus va afficher :

array(2) {
  [0]=>
  array(3) {
    ["host"]=>
    string(15) "mem1.domain.com"
    ["port"]=>
    int(11211)
    ["weight"]=>
    int(20)
  }
  [1]=>
  array(3) {
    ["host"]=>
    string(15) "mem2.domain.com"
    ["port"]=>
    int(11311)
    ["weight"]=>
    int(80)
  }
}

User Contributed Notes 1 note

up
2
rynop
13 years ago
This method no longer returns 'weight' in v2.1.0: https://github.com/php-memcached-dev/php-memcached/pull/56
Adding new notes is disabled. Please see the links in the Found A Problem? section.
To Top