Files
doc-fr/reference/memcache/functions/memcache-add.xml
T
Yannick Torres 4a239ae2da use more entitie
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@172818 c90b9560-bf6c-de11-be94-00142212c4b1
2004-11-16 22:07:23 +00:00

81 lines
2.4 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- EN-Revision: 1.1 Maintainer: yannick Status: ready -->
<refentry id="function.Memcache-add">
<refnamediv>
<refname>Memcache::add</refname>
<refpurpose>Ajout d'un élément au serveur</refpurpose>
</refnamediv>
<refsect1>
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>Memcache::add</methodname>
<methodparam><type>string</type><parameter>key</parameter></methodparam>
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>flag</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>expire</parameter></methodparam>
</methodsynopsis>
<para>
<function>Memcache::add</function> stocke la variable <parameter>var</parameter>
avec la clé <parameter>key</parameter> seulement si cette clé n'existe pas
encore sur le serveur.
<function>memcache::add</function> retourne &false; si cette clé existe déjà.
Pour le reste, la fonction <function>Memcache::add</function> se comporte de façon
similaire à la fonction <function>Memcache::set</function>.
</para>
<para>
Vous pouvez également utiliser la fonction
<function>Memcache_add</function>.
Regardez l'exemple ci-dessous.
</para>
<example>
<title>Exemple avec <function>Memcache::add</function></title>
<programlisting role="php">
<![CDATA[
<?php
$memcache_obj = memcache_connect("localhost", 11211);
/* API procédurale */
memcache_add($memcache_obj, 'var_key', 'test variable', false, 30);
/* API orientée objet */
$memcache_obj->add('var_key', 'test variable', false, 30);
?>
]]>
</programlisting>
</example>
<para>
<function>Memcache::add</function> retourne &true; en cas de succès
ou &false; en cas d'échec.
</para>
<para>
Voir aussi
<function>Memcache::set</function> et
<function>Memcache::replace</function>.
</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
-->