欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ubuntu下memcache类中delete失败的原因

程序员文章站 2024-01-08 18:56:04
...

ubuntu10.10 desktop,安装了memcached,后来写了一个php文件来测试memcache:

 

<?php
$mem = new Memcache;
$mem->connect('127.0.0.1',11211);
$mem->delete('key');
?>

 

结果在delete的时候老是报错:

 

coinsight@insight-ubuntu:~$ php clear.php 
PHP Notice:  MemcachePool::delete(): Server 127.0.0.1 (tcp 11211, udp 0) failed with: CLIENT_ERROR bad command line format.  Usage: delete <key> [noreply]
 (0) in /home/coinsight/clear.php on line 4
coinsight@insight-ubuntu:~$

 

查找了半天原因发现在delete后面加个参数就可以了,而且这个参数必须是0,其它的值同样报错:

 

<?php
$mem = new Memcache;
$mem->connect('127.0.0.1',11211);
$mem->delete('key',0);
?>

 

后来百度+GG找,原因如下:

 

nibblebot at gmail dot com 09-Jul-2010 03:58 
the Memcache::delete(key) function is broken on several combinations of memcached+pecl-memcache combinations. 

pecl-memcache 2.2.5 + memcached 1.4.2 - Memcache::delete(key) WORKS

pecl-memcache 2.2.5 + memcached 1.4.3 - Memcache::delete(key) DOES NOT WORK

pecl-memcache 2.2.5 + memcached 1.4.4 - Memcache::delete(key) WORKS

pecl-memcache 2.2.5 + memcached 1.4.5 - Memcache::delete(key) WORKS

pecl-memcache 3.0.4 + memcached 1.4.2 - Memcache::delete(key) WORKS

pecl-memcache 3.0.4 + memcached 1.4.3 - Memcache::delete(key) DOES NOT WORK

pecl-memcache 3.0.4 + memcached 1.4.4 - Memcache::delete(key) DOES NOT WORK

pecl-memcache 3.0.4 + memcached 1.4.5 - Memcache::delete(key) DOES NOT WORK

 

 

上一篇:

下一篇: