首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Memcached::addServers

(PECL memcached >= 0.1.1)

Memcached::addServers — Add multiple servers to the server pool

Description

代码语言:javascript
复制
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.

Parameters

array

Array of the servers to add to the pool.

Return Values

Returns TRUE on success or FALSE on failure.

Examples

Example #1 Memcached::addServers() example

代码语言:javascript
复制
<?php
$m?=?new?Memcached();

$servers?=?array(
????array('mem1.domain.com',?11211,?33),
????array('mem2.domain.com',?11211,?67)
);
$m->addServers($servers);
?>

See Also

  • Memcached::addServer() - Add a server to the server pool
  • Memcached::resetServerList() - Clears all servers from the server list

← Memcached::addServer

Memcached::append →

代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com