Ubuntu 10.10下Memcache类delete失败的原因
Ubuntu 10.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
解决方案:(1)手动安装对应的版本 (2)在delete函数里面多加一个参数0。
相关推荐
IT之家 2020-03-11
graseed 2020-10-28
zbkyumlei 2020-10-12
SXIAOYI 2020-09-16
jinhao 2020-09-07
impress 2020-08-26
liuqipao 2020-07-07
淡风wisdon大大 2020-06-06
yoohsummer 2020-06-01
chenjia00 2020-05-29
baike 2020-05-19
扭来不叫牛奶 2020-05-08
hxmilyy 2020-05-11
黎豆子 2020-05-07
xiongweiwei00 2020-04-29
Cypress 2020-04-25
冰蝶 2020-04-20