开发者

Cannot connect to memcached

开发者 https://www.devze.com 2023-03-03 10:39 出处:网络
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);

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

精彩评论

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