Table 6.1. PHP Client Library Store Methods
| Method | Title |
|---|---|
$object->add($key, $value [, $expiry ] [, $persistto ] [, $replicateto ]) | Add a value with the specified key that does not already exist |
$object->replace($key, $value [, $expiry ] [, $casunique ] [, $persistto ] [, $replicateto ]) | Update an existing key with a new value |
$object->set($key, $value [, $expiry ] [, $casunique ] [, $persistto ] [, $replicateto ]) | Store a value using the specified key |
$object->setMulti($kvarray [, $expiry ]) | Set multiple key/value items at once |
| API Call | $object->add($key, $value [, $expiry ] [, $persistto ] [, $replicateto ]) | ||
| Asynchronous | no | ||
| Description | Add a value with the specified key that does not already exist. Will fail if the key/value pair already exist. | ||
| Returns | scalar; supported values: | ||
COUCHBASE_E2BIG | The Object is too big to be stored on the server | ||
COUCHBASE_EINTERNAL | Internal error within the Couchbase extension | ||
COUCHBASE_ENOMEM | Out of Resources | ||
COUCHBASE_ETMPFAIL | Temporary failure; try the operation again | ||
COUCHBASE_NOT_MY_VBUCKET | The command was sent to the wrong server; may be triggered during a rebalance or failover operation. Retry the operation | ||
COUCHBASE_NOT_STORED | The object was not stored | ||
docid | Document ID on success | ||
| Arguments | |||
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). | ||
$persistto | Specify the number of nodes on which the document must be persisted to before returning. | ||
$replicateto | Specify the number of nodes on which the document must be replicated to before returning | ||
| 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->replace($key, $value [, $expiry ] [, $casunique ] [, $persistto ] [, $replicateto ]) | ||
| Asynchronous | no | ||
| Description | Update an existing key with a new value | ||
| Returns | scalar; supported values: | ||
COUCHBASE_E2BIG | The Object is too big to be stored on the server | ||
COUCHBASE_ENOMEM | Out of Resources | ||
COUCHBASE_ETMPFAIL | Temporary failure; try the operation again | ||
COUCHBASE_KEY_ENOENT | Requested document ID does not exist | ||
COUCHBASE_NOT_MY_VBUCKET | The command was sent to the wrong server; may be triggered during a rebalance or failover operation. Retry the operation | ||
COUCHBASE_NOT_STORED | The object was not stored | ||
docid | Document ID on success | ||
| Arguments | |||
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). | ||
$casunique | Unique value used to verify a key/value combination | ||
$persistto | Specify the number of nodes on which the document must be persisted to before returning. | ||
$replicateto | Specify the number of nodes on which the document must be replicated to before returning | ||
| 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->set($key, $value [, $expiry ] [, $casunique ] [, $persistto ] [, $replicateto ]) | ||
| Asynchronous | no | ||
| Description | Store a value using the specified key, whether the key already exists or not. Will overwrite a value if the given key/value already exists. | ||
| Returns | scalar; supported values: | ||
COUCHBASE_E2BIG | The Object is too big to be stored on the server | ||
COUCHBASE_ENOMEM | Out of Resources | ||
COUCHBASE_ETMPFAIL | Temporary failure; try the operation again | ||
COUCHBASE_NOT_MY_VBUCKET | The command was sent to the wrong server; may be triggered during a rebalance or failover operation. Retry the operation | ||
COUCHBASE_NOT_STORED | The object was not stored | ||
docid | Document ID on success | ||
| Arguments | |||
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). | ||
$casunique | Unique value used to verify a key/value combination | ||
$persistto | Specify the number of nodes on which the document must be persisted to before returning. | ||
$replicateto | Specify the number of nodes on which the document must be replicated to before returning | ||
| 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->addByKey($master_key, $key, $value [, $expiry ]) | ||
| Asynchronous | no | ||
| Description | Store a value with a server key | ||
| Returns | scalar (
Binary object
) | ||
| Arguments | |||
$master_key | Master key used for consistent server references | ||
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). | ||
| API Call | $object->setByKey($master_key, $key, $value [, $expiry ]) | ||
| Asynchronous | no | ||
| Description | Store a value using the specified key, whether the key already exists or not. Will overwrite a value if the given key/value already exists. | ||
| Returns | scalar (
Binary object
) | ||
| Arguments | |||
$master_key | Master key used for consistent server references | ||
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). | ||
| API Call | $object->setMultiByKey($array [, $expiry ]) | ||
| Asynchronous | no | ||
| Description | Set multiple key/value items at once on a specific server | ||
| Returns | scalar (
Binary object
) | ||
| Arguments | |||
array $array | List of things | ||
$expiry | Expiry time for key. Values larger than 30*24*60*60 seconds (30 days) are interpreted as absolute times (from the epoch). | ||
| API Call | $object->setMulti($kvarray [, $expiry ]) | ||
| Asynchronous | no | ||
| Description | Set multiple key/value items at once; updates supplied array for successful operation. | ||
| Returns | boolean; supported values: | ||
COUCHBASE_E2BIG | The Object is too big to be stored on the server | ||
COUCHBASE_ENOMEM | Out of Resources | ||
COUCHBASE_ETMPFAIL | Temporary failure; try the operation again | ||
COUCHBASE_NOT_MY_VBUCKET | The command was sent to the wrong server; may be triggered during a rebalance or failover operation. Retry the operation | ||
COUCHBASE_NOT_STORED | The object was not stored | ||
COUCHBASE_SUCCESS | Operation successful | ||
| Arguments | |||
array $kvarray | List of key/value pairs | ||
[ key , value ] | |||
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->flush() | ||
| Asynchronous | no | ||
| Description | Deletes all values from the corresponding bucket | ||
| Returns | boolean; supported values: | ||
COUCHBASE_ETMPFAIL | Temporary failure; try the operation again | ||
COUCHBASE_NOT_MY_VBUCKET | The command was sent to the wrong server; may be triggered during a rebalance or failover operation. Retry the operation | ||
COUCHBASE_SUCCESS | Operation succeeded | ||
| Arguments | |||
| None | |||
| 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 | ||