memcached docs progress.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@275072 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Andrei Zmievski 2009-02-03 00:18:50 +00:00
parent 5c7ca9e97f
commit 61738245e7
5 changed files with 211 additions and 56 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<appendix xml:id="memcached.constants" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.constants;
@ -111,6 +111,13 @@
</listitem>
</varlistentry>
<varlistentry xml:id="memcached.constants.opt-libketama-compatible">
<term><constant>Memcached::OPT_LIBKETAMA_COMPATIBLE</constant></term>
<listitem>
<para>Description here...</para>
</listitem>
</varlistentry>
<varlistentry xml:id="memcached.constants.opt-buffer-writes">
<term><constant>Memcached::OPT_BUFFER_WRITES</constant></term>
<listitem>

View file

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.1 $ -->
<refentry xml:id="memcached.addservers" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Memcached::addServers</refname>
<refpurpose>The addServers purpose</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>Memcached::addServers</methodname>
<methodparam><type>string</type><parameter>host</parameter></methodparam>
<methodparam><type>string</type><parameter>port</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>weight</parameter></methodparam>
</methodsynopsis>
<para>
The method description goes here.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>host</parameter></term>
<listitem>
<para>
Description...
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>port</parameter></term>
<listitem>
<para>
Description...
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>weight</parameter></term>
<listitem>
<para>
Description...
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Description...
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>Memcached::addServers</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
/* ... */
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>Classname::Method</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:"../../../../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
-->

View file

@ -1,20 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<refentry xml:id="memcached.getoption" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Memcached::getOption</refname>
<refpurpose>The getOption purpose</refpurpose>
<refpurpose>Retrieve a Memcached option value</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>Memcached::getOption</methodname>
<methodparam><type>string</type><parameter>option</parameter></methodparam>
<methodparam><type>int</type><parameter>option</parameter></methodparam>
</methodsynopsis>
<para>
The method description goes here.
This method returns the value of a Memcached <parameter>option</parameter>. Some options
correspond to the ones defined by libmemcached, and some are specific to
the extension. See <link linkend="memcached.constants">Memcached
Constants</link> for more information.
</para>
</refsect1>
@ -26,7 +29,7 @@
<term><parameter>option</parameter></term>
<listitem>
<para>
Description...
One of the <literal>Memcached::OPT_*</literal> constants.
</para>
</listitem>
</varlistentry>
@ -37,7 +40,8 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Description...
Returns the value of the requested option, or <literal>FALSE</literal> on
error.
</para>
</refsect1>
@ -45,18 +49,21 @@
&reftitle.examples;
<para>
<example>
<title><function>Memcached::getOption</function> example</title>
<title>Retrieving Memcached options</title>
<programlisting role="php">
<![CDATA[
<?php
/* ... */
$m = new Memcached();
var_dump($m->getOption(Memcached::OPT_COMPRESSION));
var_dump($m->getOption(Memcached::OPT_POLL_TIMEOUT));
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
bool(true)
int(1000)
]]>
</screen>
</example>

View file

@ -1,22 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<refentry xml:id="memcached.set" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Memcached::set</refname>
<refpurpose>The set purpose</refpurpose>
<refpurpose>Store data for a key</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>Memcached::set</methodname>
<modifier>public</modifier> <type>bool</type><methodname>Memcached::set</methodname>
<methodparam><type>string</type><parameter>key</parameter></methodparam>
<methodparam><type>string</type><parameter>value</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>expiration</parameter></methodparam>
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>expiration</parameter></methodparam>
</methodsynopsis>
<para>
The method description goes here.
<function>Memcached::set</function> stores the <parameter>value</parameter>
on a memcache server under the specified <parameter>key</parameter>. The
<parameter>expiration</parameter> parameter is a Unix timestamp that can be
used to control when the value is considered expired. It can be set to
<literal>0</literal> which means that the value will persist until the
server deletes it to make space for new items.
<para>The value can be any valid PHP type except for resources, because
those cannot be represented in a serialized form. If the
<constant>OPT_COMPRESSION</constant> option is turned on, the serialized
value will also be compressed before storage.</para>
</para>
</refsect1>
@ -28,7 +37,7 @@
<term><parameter>key</parameter></term>
<listitem>
<para>
Description...
The key under which to store the value.
</para>
</listitem>
</varlistentry>
@ -36,7 +45,7 @@
<term><parameter>value</parameter></term>
<listitem>
<para>
Description...
The value to store.
</para>
</listitem>
</varlistentry>
@ -44,7 +53,7 @@
<term><parameter>expiration</parameter></term>
<listitem>
<para>
Description...
The expiration time of the value, as a Unix timestamp.
</para>
</listitem>
</varlistentry>
@ -55,7 +64,8 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Description...
&return.success;
Use <methodname>Memcached::getResultCode</methodname> if necessary.
</para>
</refsect1>
@ -67,14 +77,36 @@
<programlisting role="php">
<![CDATA[
<?php
/* ... */
$m = new Memcached();
$m->addServer('localhost', 11211);
$m->set('int', 99);
$m->set('string', 'a simple string');
$m->set('array', array(11, 12));
/* expire 'object' key in 5 minutes */
$m->set('object', new stdclass, time() + 300);
var_dump($m->get('int'));
var_dump($m->get('string'));
var_dump($m->get('array'));
var_dump($m->get('object'));
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
int(99)
string(15) "a simple string"
array(2) {
[0]=>
int(11)
[1]=>
int(12)
}
object(stdClass)#1 (0) {
}
]]>
</screen>
</example>
@ -85,7 +117,7 @@
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>Classname::Method</methodname></member>
<member><methodname>Memcached::setByKey</methodname></member>
</simplelist>
</para>
</refsect1>

View file

@ -1,52 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<refentry xml:id="memcached.setoption" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Memcached::setOption</refname>
<refpurpose>The setOption purpose</refpurpose>
<refpurpose>Set a Memcached option</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>Memcached::setOption</methodname>
<methodparam><type>string</type><parameter>option</parameter></methodparam>
<methodparam><type>string</type><parameter>value</parameter></methodparam>
<methodparam><type>int</type><parameter>option</parameter></methodparam>
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
The method description goes here.
This method sets the value of a Memcached <parameter>option</parameter>.
Some options correspond to the ones defined by libmemcached, and some are
specific to the extension. See <link linkend="memcached.constants">Memcached Constants</link> for more
information.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>option</parameter></term>
<listitem>
<para>
Description...
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
Description...
</para>
</listitem>
</varlistentry>
</variablelist>
The options listed below require values specified via constants.
<itemizedlist>
<listitem><para>
<literal>Memcached::OPT_HASH</literal> requires <literal>Memcached::HASH_*</literal> values.
</para></listitem>
<listitem><para>
<literal>Memcached::OPT_DISTRIBUTION</literal> requires <literal>Memcached::DISTRIBUTION_*</literal> values.
</para></listitem>
</itemizedlist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Description...
&return.success;
</para>
</refsect1>
@ -54,18 +44,23 @@
&reftitle.examples;
<para>
<example>
<title><function>Memcached::setOption</function> example</title>
<title>Setting a Memcached option</title>
<programlisting role="php">
<![CDATA[
<?php
/* ... */
$m = new Memcached();
var_dump($m->getOption(Memcached::OPT_HASH) == Memcached::HASH_DEFAULT);
$m->setOption(Memcached::OPT_HASH, Memcached::HASH_MURMUR);
$m->setOption(Memcached::OPT_PREFIX_KEY, "widgets");
echo "Prefix key is now: ", $m->getOption(Memcached::OPT_PREFIX_KEY), "\n";
?>
]]>
</programlisting>
&example.outputs.similar;
&example.outputs;
<screen>
<![CDATA[
...
bool(true)
Prefix key is now: widgets
]]>
</screen>
</example>
@ -76,7 +71,7 @@
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>Classname::Method</methodname></member>
<member><methodname>Memcached::getOption</methodname></member>
</simplelist>
</para>
</refsect1>