问题
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