Memcached set()失败:写入失败 [英] Memcached set() fails: WRITE FAILURE

查看:714
本文介绍了Memcached set()失败:写入失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此Memcached无法写入某些键,getResultMessage()表示WRITE FAILURE
我在安装程序中使用它:

So Memcached fails to write certain keys, getResultMessage() says WRITE FAILURE
I'm using this in setup:

$this->mmcache = new Memcached();
$this->mmcache->addServer('localhost',11211, 100);
$this->mmcache->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
$this->mmcache->setOption(Memcached::OPT_SERIALIZER, Memcached::SERIALIZER_IGBINARY);
$this->mmcache->setOption(Memcached::OPT_COMPRESSION, false);

有些键每次都起作用,有些键每次都失败.我什至尝试过对密钥进行base64编码,但无论如何它们还是会失败,甚至是简单的功能,如

Some keys work every time, some fail everytime. I even tried base64 encoding the keys but they fail anyway, even simple function like

for($i=1;$i<100;$i++) {
  $this->mmcache->set('testkey'.$i,$i*100,600);
}

每次都返回WRITE FAILURE.

禁用二进制协议只会将错误更改为HOSTNAME LOOKUP FAILURE,但是就像50%的键仍然起作用,我只是无法弄清楚哪个将起作用,哪个将不起作用.

Disabling the binary protocol just changes the error to HOSTNAME LOOKUP FAILURE but like 50% of keys still work and I just can't figure out which will and which won't work.

对不起,我之前问错了问题.

Sorry I was asking wrong question before.

原始问题: v1.4.4中的内存缓存返回NULL
我正在从php的memcache中存储和读取大量数据.我正在使用常规连接到在本地主机上运行的memcache服务器.我正在使用Memcache 1.4.4

original question: Memcache in v1.4.4 returning NULL
I'm storing and reading large quantities of data in memcache from php. I'm using regular connect to memcache server which runs on localhost. I'm using Memcache 1.4.4

但是我在一次脚本运行中从内存缓存中读取的50-60个键中,有50%以上返回为null.根据php.net,当密钥不存在或过期时,Memcache::get()应该返回false.那么为什么它会返回"null"呢?

But from 50-60 keys that I'm reading from memcache in one script run, more than 50% come back as null. According to php.net, Memcache::get() should return false when key doesn't exist or expired. So why would it return "null" ?

即使对于我刚刚写给memcache的键,也会发生这种情况.我将某些内容缓存了24小时,在一分钟后,我却得到了"null". Memcache的容量甚至还没有达到50%,因此没有理由清除密钥,即使密钥被清除,它们也应该以false而不是null的形式返回.

This happens even for keys that I just wrote to memcache. I cache something for 24 hours and in a minute I'm getting "null" instead. Memcache is not even 50% full so there's no reason for keys to be purged and even if they were, they should come back as false and not null.

还有其他人遇到过这个问题吗?

Has anybody else encountered this problem ?

推荐答案

我有今天同样的问题.

事实证明,您需要使用127.0.0.1而不是localhost.

It turns out you need to use 127.0.0.1 instead of localhost.

真烦人.

这篇关于Memcached set()失败:写入失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆