0
我想使用PHP的Riak客户端,我无法找到一种方法来获取群集中所有桶的列表。 Riak网站上的文档说它支持它,但我无法找到任何可以做到的功能。PHP Riak列表桶
我想使用PHP的Riak客户端,我无法找到一种方法来获取群集中所有桶的列表。 Riak网站上的文档说它支持它,但我无法找到任何可以做到的功能。PHP Riak列表桶
该文档不提供所有功能。我在文档中找到了followinf函数。
/**
* Get all buckets.
* @return array() of RiakBucket objects
*/
function buckets() {
$url = RiakUtils::buildRestPath($this);
$response = RiakUtils::httpRequest('GET', $url.'?buckets=true');
$response_obj = json_decode($response[1]);
$buckets = array();
foreach($response_obj->buckets as $name) {
$buckets[] = $this->bucket($name);
}
return $buckets;
}
这里是你如何列出与PHP了Riak客户端的桶:
<?php
require_once('riak-php-client/riak.php');
$client = new RiakClient('127.0.0.1', 8091);
$all_buckets = $client->buckets();
var_dump($all_buckets); // etc
?>