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
[edit] Last updated: Fri, 23 Mar 2012

view this page in

Memcached::addServers

(PECL memcached >= 0.1.1)

Memcached::addServersAdd multiple servers to the server pool

Açıklama

public bool Memcached::addServers ( array $servers )

Memcached::addServers() adds servers to the server pool. Each entry in servers is supposed to be an array containing hostname, port, and, optionally, weight of the server. No connection is established to the servers at this time.

The same server may appear multiple times in the server pool, because no duplication checks are made. This is not advisable; instead, use the weight option to increase the selection weighting of this server.

Değiştirgeler

array

Array of the servers to add to the pool.

Dönen Değerler

Başarı durumunda TRUE, başarısızlık durumunda FALSE döner.

Örnekler

Örnek 1 Memcached::addServers() example

<?php
$m 
= new Memcached();

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

Ayrıca Bakınız



add a note add a note User Contributed Notes Memcached::addServers
Michael Brenden 16-Feb-2011 08: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