mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-30 15:58:55 +00:00

- Added new Runtime Configuration directives. - Updated libmemcached version requirements and new configuration options. - Added new memcached 2.0 methods to Memcached class: * deletemulti * deletemultibykey * getallkeys * touchbykey * touch * incrementbykey * decrementbykey * ispersistent * ispristine * setsaslauthdata * setoptions * resetserverlist * quit Modified fixes and modifications to reflect ChangeLog. Path provided by David Terei (davidterei@gmail.com). git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@329008 c90b9560-bf6c-de11-be94-00142212c4b1
135 lines
4 KiB
XML
135 lines
4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
|
|
<refentry xml:id="memcached.addserver" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>Memcached::addServer</refname>
|
|
<refpurpose>Add a server to the server pool</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <type>bool</type><methodname>Memcached::addServer</methodname>
|
|
<methodparam><type>string</type><parameter>host</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>port</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>weight</parameter><initializer>0</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>Memcached::addServer</function> adds the specified server to the
|
|
server pool. No connection is established to the server at this time, but
|
|
if you are using consistent key distribution option (via
|
|
<constant>Memcached::DISTRIBUTION_CONSISTENT</constant> or
|
|
<constant>Memcached::OPT_LIBKETAMA_COMPATIBLE</constant>), some of the
|
|
internal data structures will have to be updated. Thus, if you need to add
|
|
multiple servers, it is better to use
|
|
<methodname>Memcached::addServers</methodname> as the update then happens
|
|
only once.
|
|
</para>
|
|
<para>
|
|
The same server may appear multiple times in the server pool, because no
|
|
duplication checks are made. This is not advisable; instead, use the
|
|
<parameter>weight</parameter> option to increase the selection weighting of
|
|
this server.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>host</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The hostname of the memcache server. If the hostname is invalid, data-related
|
|
operations will set
|
|
<constant>Memcached::RES_HOST_LOOKUP_FAILURE</constant> result code.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>port</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The port on which memcache is running. Usually, this is
|
|
<literal>11211</literal>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>weight</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The weight of the server relative to the total weight of all the
|
|
servers in the pool. This controls the probability of the server being
|
|
selected for operations. This is used only with consistent distribution
|
|
option and usually corresponds to the amount of memory available to
|
|
memcache on that server.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.success;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>Memcached::addServer</function> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$m = new Memcached();
|
|
|
|
/* Add 2 servers, so that the second one
|
|
is twice as likely to be selected. */
|
|
$m->addServer('mem1.domain.com', 11211, 33);
|
|
$m->addServer('mem2.domain.com', 11211, 67);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><methodname>Memcached::addServers</methodname></member>
|
|
<member><methodname>Memcached::resetServerList</methodname></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|