I have been asked by the memcached maintainers to help facilitate a
change in the pecl/memcache library since I have a PHP SVN account.
However, I don't think I have karma on the pecl extension or the docs.
The delete() function is currently documented as taking a timeout
parameter. 2.2.5 does in fact send the timeout parameter. There are a
couple of problems with that.
1. The documented behavior is inaccurate. The timeout actually blocked
operations on the key. It did not delete it after the given time.
2. Since 1.4.0, memcached has only accepted a 0 for the timeout. And
that is only so that pecl/memcache would work for those people that did
not try and send the timeout. Some version was sending 1 by default.
That was fixed at some point.
So, I would like to request an immediate change to the docs based on the
attached patch. And then I can work on patching the code and submitting
that as well. But the sooner we get that behavior out of the
documentation the better. It is a constant question on the IRC channel,
mailing list and in person at conferences.
Thanks.
--
Brian - brianlm...@php.net
---------------------------
http://brian.moonspot.net/
$ svn diff delete.xml
Index: delete.xml
===================================================================
--- delete.xml (revision 300543)
+++ delete.xml (working copy)
@@ -15,10 +15,8 @@
</methodsynopsis>
<para>
- <function>Memcache::delete</function> deletes item with the
- <parameter>key</parameter>. If parameter <parameter>timeout</parameter>
- is specified, the item will expire after
- <parameter>timeout</parameter> seconds.
+ <function>Memcache::delete</function> deletes item with the
+ <parameter>key</parameter>.
Also you can use <function>memcache_delete</function> function.
</para>
@@ -36,16 +34,6 @@
</para>
</listitem>
</varlistentry>
- <varlistentry>
- <term><parameter>timeout</parameter></term>
- <listitem>
- <para>
- Execution time of the item. If it's equal to zero, the item will be
- deleted right away whereas if you set it to 30, the item will be
- deleted in 30 seconds.
- </para>
- </listitem>
- </varlistentry>
</variablelist>
</para>
</refsect1>
@@ -69,14 +57,14 @@
/* procedural API */
$memcache_obj = memcache_connect('memcache_host', 11211);
-/* after 10 seconds item will be deleted by the server */
-memcache_delete($memcache_obj, 'key_to_delete', 10);
+/* item will be deleted by the server */
+memcache_delete($memcache_obj, 'key_to_delete');
/* OO API */
$memcache_obj = new Memcache;
$memcache_obj->connect('memcache_host', 11211);
-$memcache_obj->delete('key_to_delete', 10);
+$memcache_obj->delete('key_to_delete');
?>
]]>