开发者

Cannot connect to memcached

Im trying to connect to memcached on my local server in Ubuntu:

$memcached = new Memcached;
#
$memcached->addServer('localhost', 11211, 1) or die ("Could not connect"开发者_如何学C);

var_dump($memcached);

var_dump($memcached->add('hello', 0, 400));

Why does var_dump show the following?

object(Memcached)#1 (0) { } bool(false)


False return value means there was some error. See $memcached->getResultMessage() for additional details, it may help.


Try this:

var_dump($memcached->add('hello', 0, false, 400));

The third param is a flag, to compress or not.


I see false only on add operation - maybe this key already exists, try to use set method.


check this if it can help
How to install memcache in Ubuntu

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜