PINGSVC_KV
PINGSVC_KV
Ping data (Key/Value) service.
Represents connection to the Couchbase Server
$operationTimeout : integer
The operation timeout (in microseconds) is the maximum amount of time the library will wait for an operation to receive a response before invoking its callback with a failure status.
An operation may timeout if:
$configNodeTimeout : integer
Per-node configuration timeout (in microseconds).
This timeout sets the amount of time to wait for each node within the bootstrap/configuration process. This interval is a subset of the $configTimeout option mentioned above and is intended to ensure that the bootstrap process does not wait too long for a given node. Nodes that are physically offline may never respond and it may take a long time until they are detected as being offline.
$configDelay : integer
Config refresh throttling
Modify the amount of time (in microseconds) before the configiration error threshold will forcefully be set to its maximum number forcing a configuration refresh.
Note that if you expect a high number of timeouts in your operations, you should set this to a high number. If you are using the default timeout setting, then this value is likely optimal.
$htconfigIdleTimeout : integer
Idling/Persistence for HTTP bootstrap (in microseconds)
By default the behavior of the library for HTTP bootstrap is to keep the stream open at all times (opening a new stream on a different host if the existing one is broken) in order to proactively receive configuration updates.
The default value for this setting is -1. Changing this to another number invokes the following semantics:
The configuration stream is not kept alive indefinitely. It is kept open for the number of seconds specified in this setting. The socket is closed after a period of inactivity (indicated by this setting).
manager() : \Couchbase\BucketManager
Returns an instance of a CouchbaseBucketManager for performing management operations against a bucket.
setTranscoder(callable $encoder, callable $decoder)
Sets custom encoder and decoder functions for handling serialization.
callable | $encoder | |
callable | $decoder |
<?php $cluster = new \Couchbase\Cluster("couchbase://localhost"); $bucket = $cluster->openBucket("default"); $bucket->setTranscoder("\\Couchbase\\defaultEncoder", "\\Couchbase\\passthruDecoder"); $bucket->upsert("foo", ["bar" => "baz"]); $value = $bucket->get("foo")->value; var_dump($value); // => string(13) "{"bar":"baz"}"
get(string|array $ids, array $options = array()) : \Couchbase\Document|array
Retrieves a document
string|array | $ids | one or more IDs |
array | $options | options
|
document or list of the documents
getAndLock(string|array $ids, integer $lockTime, array $options = array()) : \Couchbase\Document|array
Retrieves a document and locks it.
After the document has been locked on the server, its CAS would be masked, and all mutations of it will be rejected until the server unlocks the document automatically or it will be done manually with \Couchbase\Bucket::unlock() operation.
string|array | $ids | one or more IDs |
integer | $lockTime | time to lock the documents |
array | $options | options
|
document or list of the documents
getAndTouch(string|array $ids, integer $expiry, array $options = array()) : \Couchbase\Document|array
Retrieves a document and updates its expiration time.
string|array | $ids | one or more IDs |
integer | $expiry | time after which the document will not be accessible. If larger than 30 days (606024*30), it will be interpreted by the server as absolute UNIX time (seconds from epoch 1970-01-01T00:00:00). |
array | $options | options
|
document or list of the documents
getFromReplica(string|array $ids, array $options = array()) : \Couchbase\Document|array
Retrieves a document from a replica.
string|array | $ids | one or more IDs |
array | $options | options
|
document or list of the documents
upsert(string|array $ids, mixed $value, array $options = array()) : \Couchbase\Document|array
Inserts or updates a document, depending on whether the document already exists on the cluster.
string|array | $ids | one or more IDs |
mixed | $value | value of the document |
array | $options | options
|
document or list of the documents
insert(string|array $ids, mixed $value, array $options = array()) : \Couchbase\Document|array
Inserts a document. This operation will fail if the document already exists on the cluster.
string|array | $ids | one or more IDs |
mixed | $value | value of the document |
array | $options | options
|
document or list of the documents
replace(string|array $ids, mixed $value, array $options = array()) : \Couchbase\Document|array
Replaces a document. This operation will fail if the document does not exists on the cluster.
string|array | $ids | one or more IDs |
mixed | $value | value of the document |
array | $options | options
|
document or list of the documents
append(string|array $ids, mixed $value, array $options = array()) : \Couchbase\Document|array
Appends content to a document.
On the server side it just contatenate passed value to the existing one. Note that this might make the value un-decodable. Consider sub-document API for partial updates of the JSON documents.
string|array | $ids | one or more IDs |
mixed | $value | value of the document |
array | $options | options
|
document or list of the documents
prepend(string|array $ids, mixed $value, array $options = array()) : \Couchbase\Document|array
Prepends content to a document.
On the server side it just contatenate existing value to the passed one. Note that this might make the value un-decodable. Consider sub-document API for partial updates of the JSON documents.
string|array | $ids | one or more IDs |
mixed | $value | value of the document |
array | $options | options
|
document or list of the documents
remove(string|array $ids, array $options = array()) : \Couchbase\Document|array
Removes the document.
string|array | $ids | one or more IDs |
array | $options | options
|
document or list of the documents
unlock(string|array $ids, array $options = array()) : \Couchbase\Document|array
Unlocks previously locked document
string|array | $ids | one or more IDs |
array | $options | options
|
document or list of the documents
touch(string|array $ids, integer $expiry, array $options = array()) : \Couchbase\Document|array
Updates document's expiration time.
string|array | $ids | one or more IDs |
integer | $expiry | time after which the document will not be accessible. If larger than 30 days (606024*30), it will be interpreted by the server as absolute UNIX time (seconds from epoch 1970-01-01T00:00:00). |
array | $options | options
|
document or list of the documents
counter(string|array $ids, integer $delta = 1, array $options = array()) : \Couchbase\Document|array
Increments or decrements a key (based on $delta)
string|array | $ids | one or more IDs |
integer | $delta | the number whih determines the sign (positive/negative) and the value of the increment |
array | $options | options
|
document or list of the documents
lookupIn(string $id) : \Couchbase\LookupInBuilder
Returns a builder for reading subdocument API.
string | $id | The ID of the JSON document |
retrieveIn(string $id, string $paths) : \Couchbase\DocumentFragment
Retrieves specified paths in JSON document
This is essentially a shortcut for lookupIn($id)->get($paths)->execute()
.
string | $id | The ID of the JSON document |
string | $paths | List of the paths inside JSON documents (see "Path syntax" section of the "Sub-Document Operations" documentation). |
mutateIn(string $id, string $cas) : \Couchbase\MutateInBuilder
Returns a builder for writing subdocument API.
string | $id | The ID of the JSON document |
string | $cas | Last known document CAS value for optimisti locking |
query(\Couchbase\N1qlQuery|\Couchbase\ViewQuery|\Couchbase\SpatialViewQuery|\Couchbase\SearchQuery|\Couchbase\AnalyticsQuery $query, boolean $jsonAsArray = false) : object
Performs a query to Couchbase Server
\Couchbase\N1qlQuery|\Couchbase\ViewQuery|\Couchbase\SpatialViewQuery|\Couchbase\SearchQuery|\Couchbase\AnalyticsQuery | $query | |
boolean | $jsonAsArray | if true, the values in the result rows (or hits) will be represented as
PHP arrays, otherwise they will be instances of the |
Query-specific result object.
ping(integer $services, string $reportId = NULL) : array
Try to reach specified services, and measure network latency.
integer | $services | bitwise mask of required services (and all services when zero) |
string | $reportId | custom identifier, which will be appended to "id" property in report |
the report object
encryptFields(array $document, $fieldOptions, string $prefix = null) : array
Encrypt fields inside specified document.
array | $document | document structure |
$fieldOptions | ||
string | $prefix | optional prefix for modified field (when null, the library will use "__crypt") |
where the fields encrypted
decryptFields(array $document, $fieldOptions, string $prefix = null) : array
Decrypt fields inside specified document.
array | $document | document structure |
$fieldOptions | ||
string | $prefix | optional prefix for modified field (when null, the library will use "__crypt") |
where the fields decrypted