Search:

Search all manuals
Search this manual
Manual
Couchbase Client Library: PHP 1.1
Community Wiki and Resources
Wiki: PHP Client Library
PHP Client Library
Couchbase Developer Guide 2.0
Couchbase Server Manual 2.0
SDK Forum
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
7 Update Operations
Chapter Sections
Chapters

7.2. CAS And Locking Operations

API Call$object->cas($casunique, $key, $value [, $expiry ])
Asynchronousno
Description Compare and set a value providing the supplied CAS key matches
Returnsboolean; supported values:
 COUCHBASE_E2BIGThe Object is too big to be stored on the server 
 COUCHBASE_ENOMEMOut of Resources 
 COUCHBASE_ETMPFAILTemporary failure; try the operation again 
 COUCHBASE_KEY_EEXISTSThe key exists, but the supplied CAS ID did not match the one for the object in the cluster 
 COUCHBASE_KEY_ENOENTRequested document ID does not exist 
 COUCHBASE_NOT_MY_VBUCKETThe command was sent to the wrong server; may be triggered during a rebalance or failover operation. Retry the operation 
 COUCHBASE_NOT_STOREDThe object was not stored 
 COUCHBASE_SUCCESSOperation succeeded 
Arguments 
$casunique Unique value used to verify a key/value combination
string $key Document ID used to identify the value
object $value Value to be stored
$expiry Expiry time for key. Values larger than 30*24*60*60 seconds (30 days) are interpreted as absolute times (from the epoch).
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->getAndLock($key [, $casarray ] [, $getl-expiry ])
Asynchronousno
Description Get the value for a key, lock the key from changes
Returnsscalar; supported values:
 COUCHBASE_ETMPFAILTemporary failure; try the operation again 
 COUCHBASE_KEY_ENOENTRequested document ID does not exist 
 COUCHBASE_NOT_MY_VBUCKETThe command was sent to the wrong server; may be triggered during a rebalance or failover operation. Retry the operation 
 objectRequested object 
Arguments 
string $key Document ID used to identify the value
array $casarray Array of unique values used to verify a key/value combination
$getl-expiry Expiry time for lock
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->getAndLockMulti($keycollection [, $casarray ] [, $getl-expiry ])
Asynchronousno
Description Get the value for a key, lock the key from changes
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
$getl-expiry Expiry time for lock
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->unlock($key, $casunique)
Asynchronousno
Description Unlock a previously locked key by providing the corresponding CAS value that was returned during the lock
Returnsboolean; supported values:
 COUCHBASE_KEY_ENOENTRequested document ID does not exist 
 COUCHBASE_SUCCESSOperation succeeded 
Arguments 
string $key Document ID used to identify the value
$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