Couchbase C Client
2.4.4
|
Get one or more keys from the cluster.
Included in these functions are means by which to temporarily lock access to an item, modify its expiration, and retrieve an item from a replica.
Functions | |
lcb_get_callback | lcb_set_get_callback (lcb_t, lcb_get_callback callback) |
Set the callback to be invoked when an item is received as a result of an lcb_get() operation. More... | |
lcb_error_t | lcb_get (lcb_t instance, const void *command_cookie, lcb_SIZE num, const lcb_get_cmd_t *const *commands) |
Get a number of values from the cache. More... | |
Macros | |
#define | LCB_DATATYPE_JSON |
Value is JSON. | |
Typedefs | |
typedef void(* | lcb_get_callback )(lcb_t instance, const void *cookie, lcb_error_t error, const lcb_get_resp_t *resp) |
The callback function for a "get-style" request. More... | |
Enumerations | |
enum | lcb_VALUEFLAGS |
Flags which can be returned int the the lcb_GETRESPv0::datatype field. More... | |
lcb_get_callback lcb_set_get_callback | ( | lcb_t | , |
lcb_get_callback | callback | ||
) |
Set the callback to be invoked when an item is received as a result of an lcb_get() operation.
callback | the new callback to install. Pass NULL to only query the current callback |
lcb_error_t lcb_get | ( | lcb_t | instance, |
const void * | command_cookie, | ||
lcb_SIZE | num, | ||
const lcb_get_cmd_t *const * | commands | ||
) |
Get a number of values from the cache.
If you specify a non-zero value for expiration, the server will update the expiration value on the item (refer to the documentation on lcb_store to see the meaning of the expiration). All other members should be set to zero.
It is possible to get an item with a lock that has a timeout. It can then be unlocked with either a CAS operation or with an explicit unlock command.
You may specify the expiration value for the lock in the expiration (setting it to 0 cause the server to use the default value).
Get and lock the key:
instance | the instance used to batch the requests from |
command_cookie | A cookie passed to all of the notifications from this command |
num | the total number of elements in the commands array |
commands | the array containing the items to get |
struct lcb_GETCMDv0 |
Get Command Structure.
Data Fields | ||
---|---|---|
const void * | key | Key to retrieve. |
lcb_SIZE | nkey | Key length. |
lcb_time_t | exptime |
If this parameter is specified and lock is not set then the server will also update the object's expiration time while retrieving the key. If |
int | lock |
If this parameter is set then the server will in addition to retrieving the item also lock the item, making it so that subsequent attempts to lock and/or modify the same item will fail with an error (either LCB_KEY_EEXISTS or LCB_ETMPFAIL). The lock will be released when one of the following happens:
|
struct lcb_get_cmd_t |
lcb_get() Command Wrapper Structure
Data Fields | ||
---|---|---|
int | version | |
union lcb_get_cmd_t | v |
struct lcb_GETRESPv0 |
struct lcb_get_resp_t |
lcb_get() response wrapper structure
Data Fields | ||
---|---|---|
int | version | |
union lcb_get_resp_t | v |
typedef void(* lcb_get_callback)(lcb_t instance, const void *cookie, lcb_error_t error, const lcb_get_resp_t *resp) |
The callback function for a "get-style" request.
instance | the instance performing the operation |
cookie | the cookie associated with with the command |
error | The status of the operation |
resp | More information about the actual item (only key and nkey is valid if error != LCB_SUCCESS ) |
enum lcb_VALUEFLAGS |
Flags which can be returned int the the lcb_GETRESPv0::datatype field.
Enumerator | |
---|---|
LCB_VALUE_RAW |
Value is raw bytes. |
LCB_VALUE_F_JSON |
Value is JSON. |
LCB_VALUE_F_SNAPPYCOMP |
Value is compressed as Snappy. |