PHP Riak列表存储桶
我正在尝试使用Riak client for PHP,但我找不到一种方法来获取集群中所有bucket的列表。Riak网站上的文档说它支持Riak,但我找不到任何功能。文档没有提供所有功能。我在文档中找到了followinf函数PHP Riak列表存储桶,php,riak,Php,Riak,我正在尝试使用Riak client for PHP,但我找不到一种方法来获取集群中所有bucket的列表。Riak网站上的文档说它支持Riak,但我找不到任何功能。文档没有提供所有功能。我在文档中找到了followinf函数 /** * Get all buckets. * @return array() of RiakBucket objects */ function buckets() { $url = RiakUtils::buildRestPath($this); $respon
/**
* 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;
}以下是如何使用Riak PHP客户端列出存储桶:
<?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
?>