PHP Memcache connects to couchbase but can't do anything else

那年仲夏 提交于 2020-01-02 10:31:59

问题


I have a new CouchBase server set up on Windows 7, and Apache with PHP and php_memcache.dll configured correctly. I can connect to the server, but cannot get stats, or set any values. Any suggestions what I am doing wrong? I've turned the firewall off, but as I can connect to 11211, I think connectivity is OK, anyway?

Here's a test script

$memcache = new Memcache;
$memcache->connect('127.0.0.1', 11211) or die ("Could not connect");
var_dump($memcache);
echo "<hr />";
$allSlabs = $memcache->getExtendedStats('slabs');
var_dump($allSlabs);
echo "<hr />";
$items = $memcache->getExtendedStats('items');
var_dump($items);
echo "<hr />";
$tmp_object = new stdClass;
$tmp_object->str_attr = 'test';
$tmp_object->int_attr = 123;
$t = $memcache->set("rule_$uid", $tmp_object, false, 10);
var_dump($t);
exit;

which outputs

object(Memcache)#3 (1) { ["connection"]=> resource(8) of type (memcache connection) }
------------------------------------
array(1) { ["127.0.0.1:11211"]=> bool(false) }
------------------------------------
array(1) { ["127.0.0.1:11211"]=> bool(false) }
------------------------------------
bool(false)

回答1:


If it's a Couchbase bucket type (selectable at install time) there would be no "stats slabs" or "stats items". That explains those two. As to the item you're getting and setting, there is no $uid anywhere else in the code snippet, so there must be more to this somewhere else?



来源:https://stackoverflow.com/questions/10435949/php-memcache-connects-to-couchbase-but-cant-do-anything-else

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!