Name

lcb_get_cookie — Get userdata stored for instance

Synopsis

cc [ flag … ] file… -lcouchbase [ library … ]

#include <libcouchbase/couchbase.h>
const void *lcb_get_cookie(lcb_t instance);
void lcb_set_cookie(lcb_t instance, const void * cookie);

DESCRIPTION

These functions are used to attach or retrieve a user-defined value to a libcouchbase instance.

The lcb_set_cookie() function attach a cookie to the specified libcouchbase instance. The cookie may be whatever you want (an address of a structure, an integer value), and libcouchbase will not do anything with the value.

The lcb_get_cookie() function returns the same cookie stored with lcb_set_cookie().

RETURN VALUES

lcb_get_cookie() returns the value set by lcb_set_cookie(), or NULL if no value is set by lcb_set_cookie().

EXAMPLES

#include <libcouchbase/couchbase.h>
...
lcb_t instance;
...
lcb_set_cookie(instance, "this is the cookie");
fprintf(stdout, "%s\n", lcb_get_cookie(instance);
...

ATTRIBUTES

See lcb_attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE

Interface Stability

Committed

MT-Level

MT-Safe

COPYRIGHT

Copyright 2010-2013 Couchbase, Inc.

SEE ALSO

Learn more at http://www.couchbase.com/communities/c.

libcouchbase(3lib), lcb_create(3couchbase), lcb_attributes(5)