\CouchbaseClusterManager

Summary

Methods
Properties
Constants
__construct()
getInfo()
getBucketInfo()
createBucket()
modifyBucket()
deleteBucket()
flushBucket()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

__construct()

__construct(array $hosts, string $user, string $password)

Create a new instance of the CouchbaseClusterManager.

Parameters

array $hosts

This is an array of hostnames[:port] where the Couchbase cluster is running. The port number is optional (and only needed if you're using a non- standard port).

string $user

This is the username used for authentications towards the cluster

string $password

This is the password used to authenticate towards the cluster

getInfo()

getInfo() : string

Get information about the cluster.

Returns

string —

a JSON encoded string containing information of the cluster.

getBucketInfo()

getBucketInfo(string $name) : string

Get information about one (or more) buckets.

Parameters

string $name

if specified this is the name of the bucket to get information about

Returns

string —

A JSON encoded string containing all information about the requested bucket(s).

createBucket()

createBucket(string $name, array $attributes)

Create a new bucket in the cluster with a given set of attributes.

The bucket may be created with the following attributes:

PropertyDescription
typeThe type of bucket to create. This may be memcached or couchbase
authThe type of authentication to use to access the bucket. This may be sasl or none. If none is used you must specicy a port attribute. for sasl you may specify a password attribute
enable flushIf flush() should be allowed on the bucket
parallel compactionIf compaction of the database files should be performed in parallel or not (only applicable for couchbase buckets)
portIf the auth attribute is set to none this attribute specifies the port number where clients may access the bucket.
quotaThis specifies the amount of memory in MB the bucket should consume on each node in the cluster
index replicasIf replicas should be indexed or not (only applicable for couchbase buckets)
replicasThe number of replicas to create per document. The current version of Couchbase supports the following values: 0, 1, 2 and 3 (only applicable for couchbase buckets)
passwordThis is the password used to access the bucket if the auth attribute is set to sasl

Parameters

string $name

the name of the bucket to create

array $attributes

a hashtable specifying the attributes for the bucket to create.

modifyBucket()

modifyBucket(string $name, array $attributes)

Modify the attributes for a given bucket.

Please note that you have to specify all attributes for the bucket, so if you want to change a single attribute you should get the current attributes, change the one you want and store the updated attribute set.

For a description of the different attribytes, see createBucket()

Parameters

string $name

the name of the bucket to modify

array $attributes

a hashtable specifying the new attributes for the bucket

deleteBucket()

deleteBucket(string $name)

Delete the named bucket.

Parameters

string $name

the bucket to delete

flushBucket()

flushBucket(string $name)

Flush (delete the content) the named bucket.

Parameters

string $name

the bucket to flush