php-doc-en/reference/memcached/memcached/getdelayed.xml
2012-03-12 05:55:59 +00:00

160 lines
3.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="memcached.getdelayed" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Memcached::getDelayed</refname>
<refpurpose>Request multiple items</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>Memcached::getDelayed</methodname>
<methodparam><type>array</type><parameter>keys</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>with_cas</parameter></methodparam>
<methodparam choice="opt"><type>callable</type><parameter>value_cb</parameter></methodparam>
</methodsynopsis>
<para>
<function>Memcached::getDelayed</function> issues a request to memcache for
multiple items the keys of which are specified in the
<parameter>keys</parameter> array. The method does not wait for response
and returns right away. When you are ready to collect the items, call
either <methodname>Memcached::fetch</methodname> or
<methodname>Memcached::fetchAll</methodname>. If <parameter>with_cas</parameter>
is true, the CAS token values will also be requested.
</para>
<para>
Instead of fetching the results explicitly, you can specify a <link
linkend="memcached.callbacks">result callback</link> via
<parameter>value_cb</parameter> parameter.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>keys</parameter></term>
<listitem>
<para>
Array of keys to request.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>with_cas</parameter></term>
<listitem>
<para>
Whether to request CAS token values also.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value_cb</parameter></term>
<listitem>
<para>
The result callback or &null;.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
&memcached.result.getresultcode;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>Memcached::getDelayed</function> example</title>
<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));
$m->getDelayed(array('int', 'array'), true);
var_dump($m->fetchAll());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
array(2) {
[0]=>
array(3) {
["key"]=>
string(3) "int"
["value"]=>
int(99)
["cas"]=>
float(2363)
}
[1]=>
array(3) {
["key"]=>
string(5) "array"
["value"]=>
array(2) {
[0]=>
int(11)
[1]=>
int(12)
}
["cas"]=>
float(2365)
}
}
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>Memcached::getDelayedByKey</methodname></member>
<member><methodname>Memcached::fetch</methodname></member>
<member><methodname>Memcached::fetchAll</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
-->