mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-19 10:28:54 +00:00
77 lines
2.2 KiB
XML
77 lines
2.2 KiB
XML
![]() |
<?xml version="1.0" encoding="iso-8859-1"?>
|
||
|
<!-- $Revision: 1.1 $ -->
|
||
|
<refentry id="function.Memcache-replace">
|
||
|
<refnamediv>
|
||
|
<refname>Memcache::replace</refname>
|
||
|
<refpurpose>Replace value of the existing item</refpurpose>
|
||
|
</refnamediv>
|
||
|
<refsect1>
|
||
|
<title>Description</title>
|
||
|
<methodsynopsis>
|
||
|
<type>bool</type><methodname>Memcache::replace</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::replace</function> should be used to replace value of
|
||
|
existing item with <parameter>key</parameter>. In case if item with such
|
||
|
key doesn't exists, <function>Memcache::replace</function> returns
|
||
|
&false;. For the rest <function>Memcache::replace</function> behaves
|
||
|
similarly to <function>Memcache::set</function>.
|
||
|
</para>
|
||
|
<para>
|
||
|
Also you can use <function>memcache_replace</function> function.
|
||
|
See example below.
|
||
|
</para>
|
||
|
<example>
|
||
|
<title><function>Memcache::replace</function> example</title>
|
||
|
<programlisting role="php">
|
||
|
<![CDATA[
|
||
|
<?php
|
||
|
|
||
|
$memcache_obj = memcache_connect('memcache_host', 11211);
|
||
|
|
||
|
/* procedural API */
|
||
|
memcache_replace($memcache_obj, "test_key", "some variable", false, 30);
|
||
|
|
||
|
/* OO API */
|
||
|
$memcache_obj->replace("test_key", "some variable", false, 30);
|
||
|
|
||
|
?>
|
||
|
]]>
|
||
|
</programlisting>
|
||
|
</example>
|
||
|
<para>
|
||
|
&return.success;
|
||
|
</para>
|
||
|
<para>
|
||
|
See also
|
||
|
<function>Memcache::set</function>,
|
||
|
<function>Memcache::add</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
|
||
|
-->
|