\CouchbaseBucket

Represents a bucket connection.

Note: This class must be constructed by calling the openBucket method of the CouchbaseCluster class.

Summary

Methods
Properties
Constants
getName()
manager()
enableN1ql()
insert()
upsert()
replace()
append()
prepend()
remove()
get()
getAndTouch()
getAndLock()
getFromReplica()
touch()
counter()
unlock()
_search()
query()
lookupIn()
retrieveIn()
mutateIn()
setTranscoder()
$operationTimeout
$viewTimeout
$durabilityInterval
$durabilityTimeout
$httpTimeout
$configTimeout
$configDelay
$configNodeTimeout
$htconfigIdleTimeout
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$authenticator
N/A

Properties

$operationTimeout

$operationTimeout : integer

Type

integer

$viewTimeout

$viewTimeout : integer

Type

integer

$durabilityInterval

$durabilityInterval : integer

Type

integer

$durabilityTimeout

$durabilityTimeout : integer

Type

integer

$httpTimeout

$httpTimeout : integer

Type

integer

$configTimeout

$configTimeout : integer

Type

integer

$configDelay

$configDelay : integer

Type

integer

$configNodeTimeout

$configNodeTimeout : integer

Type

integer

$htconfigIdleTimeout

$htconfigIdleTimeout : integer

Type

integer

$authenticator

$authenticator : 

Type

Methods

getName()

getName() : string

Returns bucket name

Returns

string —

name of the bucket

manager()

manager() : \CouchbaseBucketManager

Returns an instance of a CouchbaseBucketManager for performing management operations against a bucket.

Returns

\CouchbaseBucketManager

enableN1ql()

enableN1ql(  $hosts) 

Enables N1QL support on the client. A cbq-server URI must be passed.

This method will be deprecated in the future in favor of automatic configuration through the connected cluster.

Parameters

$hosts

An array of host/port combinations which are N1QL servers attached to the cluster.

insert()

insert(string|array  $ids, mixed  $val = NULL, array  $options = array()) : mixed

Inserts a document. This operation will fail if the document already exists on the cluster.

Parameters

string|array $ids
mixed $val
array $options

expiry(integer), persist_to(integer), replicate_to(integer)

Returns

mixed

upsert()

upsert(string|array  $ids, mixed  $val = NULL, array  $options = array()) : mixed

Inserts or updates a document, depending on whether the document already exists on the cluster.

Parameters

string|array $ids
mixed $val
array $options

expiry(integer), persist_to(integer), replicate_to(integer)

Returns

mixed

replace()

replace(string|array  $ids, mixed  $val = NULL, array  $options = array()) : mixed

Replaces a document.

Parameters

string|array $ids
mixed $val
array $options

cas(string), expiry(integer), persist_to(integer), replicate_to(integer)

Returns

mixed

append()

append(string|array  $ids, mixed  $val = NULL, array  $options = array()) : mixed

Appends content to a document.

Parameters

string|array $ids
mixed $val
array $options

cas(string), persist_to(integer), replicate_to(integer)

Returns

mixed

prepend()

prepend(string|array  $ids, mixed  $val = NULL, array  $options = array()) : mixed

Prepends content to a document.

Parameters

string|array $ids
mixed $val
array $options

cas(string), persist_to(integer), replicate_to(integer)

Returns

mixed

remove()

remove(string|array  $ids, array  $options = array()) : mixed

Deletes a document.

Parameters

string|array $ids
array $options

cas(string), persist_to(integer), replicate_to(integer)

Returns

mixed

get()

get(string|array  $ids, array  $options = array()) : mixed

Retrieves a document.

Parameters

string|array $ids
array $options

lock(integer), expiry(integer)

Returns

mixed

getAndTouch()

getAndTouch(string  $id, integer  $expiry, array  $options = array()) : mixed

Retrieves a document and simultaneously updates its expiry.

Parameters

string $id
integer $expiry
array $options

Returns

mixed

getAndLock()

getAndLock(string  $id, integer  $lockTime, array  $options = array()) : mixed

Retrieves a document and locks it.

Parameters

string $id
integer $lockTime
array $options

Returns

mixed

getFromReplica()

getFromReplica(string  $id, array  $options = array()) : mixed

Retrieves a document from a replica.

Parameters

string $id
array $options

index(integer)

Returns

mixed

touch()

touch(string  $id, integer  $expiry, array  $options = array()) : mixed

Updates a documents expiry.

Parameters

string $id
integer $expiry
array $options

Returns

mixed

counter()

counter(string|array  $ids, integer  $delta, array  $options = array()) : mixed

Increment or decrements a key (based on $delta).

Parameters

string|array $ids
integer $delta
array $options

initial(integer), expiry(integer)

Returns

mixed

unlock()

unlock(string|array  $ids, array  $options = array()) : mixed

Unlocks a key previous locked with a call to get().

Parameters

string|array $ids
array $options

cas(string)

Returns

mixed

_search()

_search(  $queryObj,   $json_asarray) 

Parameters

$queryObj
$json_asarray

query()

query(\CouchbaseQuery  $query,   $json_asarray = false) : mixed

Performs a query (either ViewQuery or N1qlQuery).

Parameters

\CouchbaseQuery $query
$json_asarray

Throws

\CouchbaseException

Returns

mixed

lookupIn()

lookupIn(string  $id) : \CouchbaseLookupInBuilder

Creates a CouchbaseLookupInBuilder object with which you can then use method-chaining to populate them with lookup operations and then later execute.

Parameters

string $id

Returns

\CouchbaseLookupInBuilder

retrieveIn()

retrieveIn(string  $id, string  ...$keys) 

Shortcut to alternative to constructing a builder for getting multiple paths in the document.

Parameters

string $id
string $keys variadic

mutateIn()

mutateIn(string  $id, string  $cas = null) : \CouchbaseMutateInBuilder

Creates a CouchbaseMutateInBuilder object with which you can then use method-chaining to populate them with mutation operations and then later execute.

Parameters

string $id
string $cas

Returns

\CouchbaseMutateInBuilder

setTranscoder()

setTranscoder(string  $encoder, string  $decoder) 

Sets custom encoder and decoder functions for handling serialization.

Parameters

string $encoder

The encoder function name

string $decoder

The decoder function name