Search:

Search all manuals
Search this manual
Manual
Membase Client Library: PHP
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
Membase Client Library: PHP
Chapters

Chapter 4. Membase Client Library: PHP — Retrieve Operations

Table 4.1. PHP Client Library Retrieval Methods

MethodTitle
$object->fetch($key [, $keyn ]) Fetch the next delayed result set document
$object->fetchAll($key [, $keyn ]) Fetch all the delayed result set documents
$object->get($key [, $callback ] [, $casunique ]) Get one or more key values
$object->getDelayed($keyn [, $with_cas ] [, $callback ]) Get a key to be fetched later
$object->getMulti($keycollection [, $casarray ]) Get one or more key values
$object->getAndLock($key [, $casarray ] [, $getl-expiry ]) Get the value for a key, lock the key from changes
$object->getAndLockMulti($keycollection [, $casarray ] [, $getl-expiry ]) Get the value for a key, lock the key from changes
$object->getAndTouch($key, $expiry) Get a value and update the expiration time for a given key
$object->getAndTouchMulti($key, $expiry) Get a value and update the expiration time for a given key
$object->unlock($key, $casunique) Unlock a previously locked key

API Call$object->get($key [, $callback ] [, $casunique ])
Asynchronousno
Description Get one or more key values
Returnsscalar; supported values:
 COUCHBASE_KEY_ENOENTRequested document ID does not exist 
 objectRequested object 
Arguments 
string $key Document ID used to identify the value
mixed $callback Callback function or method to be called
$casunique Unique value used to verify a key/value combination
Errors 
CouchbaseAuthenticationException Authentication to the Couchbase cluster failed
CouchbaseException Base exception class for all Couchbase exceptions
CouchbaseIllegalKeyException The key provided is not a legal key identifier
CouchbaseLibcouchbaseException An error occurred within the libcouchbase library used by th PHP extension
CouchbaseServerException An error occurred within the Couchbase cluster
API Call$object->getMulti($keycollection [, $casarray ])
Asynchronousno
Description Get one or more key values
Returnsarray ( Array of key/value pairs for each document, or key/error condition for each failure )
Arguments 
array $keycollection One or more keys used to reference a value
array $casarray Array of unique values used to verify a key/value combination
API Call$object->getDelayed($keyn [, $with_cas ] [, $callback ])
Asynchronousyes
Description Get one or more key values
Returnsboolean; supported values:
 COUCHBASE_KEY_ENOENTRequested document ID does not exist 
 COUCHBASE_SUCCESSOperation succeeded 
Arguments 
array $keyn One or more keys used to reference a value
boolean $with_cas Whether to return the CAS value for a document
mixed $callback Callback function or method to be called
API Call$object->fetch($key [, $keyn ])
Asynchronousyes
Description Fetch the next delayed result set document
Returnsarray ( An array of the next document retrieved, or NULL if no more documents )
Arguments 
string $key Document ID used to identify the value
array $keyn One or more keys used to reference a value
API Call$object->fetchAll($key [, $keyn ])
Asynchronousyes
Description Fetch all the delayed result set documents
Returnsarray ( An array of all the remaining documents retrieved, or NULL if no more documents )
Arguments 
string $key Document ID used to identify the value
array $keyn One or more keys used to reference a value
API Call$object->getByKey($master_key, $key [, $cache_callback ] [, $casunique ])
Asynchronousno
Description Get one or more key values
Returnsscalar ( Binary object )
Arguments 
$master_key Master key used for consistent server references
string $key Document ID used to identify the value
scalar $cache_callback Function to be called in the form function($key, $value)
$casunique Unique value used to verify a key/value combination
API Call$object->getDelayedByKey($master_key, $keyn [, $with_cas ] [, $callback ])
Asynchronousno
Description Get one or more key values
Returnsscalar ( Binary object )
Arguments 
$master_key Master key used for consistent server references
array $keyn One or more keys used to reference a value
boolean $with_cas Whether to return the CAS value for a document
mixed $callback Callback function or method to be called
API Call$object->getMultiByKey($master_key, $keyn [, $cas_token ] [, $flags ])
Asynchronousno
Description Get one or more key values
Returnsscalar ( Binary object )
Arguments 
$master_key Master key used for consistent server references
array $keyn One or more keys used to reference a value
float $cas_token CAS token for conditional operations
$flags Flags for storage options. Flags are ignored by the server byt preserved for use by the client.
API Call$object->getResultCode()
Asynchronousno
Description Returns the result code for the last operation
Returns ()
Arguments 
 None  
API Call$object->getResultMessage()
Asynchronousno
Description Returns the result message for the last operation
Returns ()
Arguments 
 None  
API Call$object->getVersion()
Asynchronousno
Description Returns the versions of all servers in the server pool
Returnsarray; supported values:
 arrayArray of the version number for each memcached server in cluster 
Arguments 
 None