downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Memcached::append> <Memcached::addServer
Last updated: Fri, 20 May 2011

view this page in

Memcached::addServers

(PECL memcached >= 0.1.1)

Memcached::addServersAñadir múltiple servidores al grupo de servidores

Descripción

public bool Memcached::addServers ( array $servers )

Memcached::addServers() añade servidores al grupo de servidores. Cada entrada en servidores debe ser un array conteniendo el nombre del servidor, puerto y opcionalmente el peso de importancia del servidor. No se estabecerá conexión a los servidores en este proceso.

Si no se tiene en cuenta que esta función no realiza comprobaciones de duplicados, el mismo servidor puede aparecer varias veces el en grupo de servidores. No es aconsejable, en su lugar, usar la opción weight para incrementar el peso de importancia de un servidor.

Parámetros

array

Array de servidores a añadir en el grupo de servidores.

Valores devueltos

Devuelve TRUE en caso de éxito o FALSE en caso de error.

Ejemplos

Example #1 Ejemplo de Memcached::addServers()

<?php
$m 
= new Memcached();

$servers = array(
    array(
'mem1.domain.com'1121133),
    array(
'mem2.domain.com'1121167)
);
$m->addServers($servers);
?>

Ver también



add a note add a note User Contributed Notes Memcached::addServers
Michael Brenden 17-Feb-2011 11:27
See the note for __construct()

Important to not call ->addServers() every run -- only call it if no servers exist (check getServerList() ); otherwise, since addServers() does not check for dups, it will let you add the same server again and again and again, resultings in hundreds if not thousands of connections to the MC daemon.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites