1 ========================
2 Working with result sets
3 ========================
6 Work with memcached_result_st
14 C Client Library for memcached (libmemcached, -lmemcached)
25 #include <libmemcached/memcached.h>
28 memcached_result_create (memcached_st *ptr,
29 memcached_result_st *result);
31 void memcached_result_free (memcached_result_st *result);
33 const char * memcached_result_key_value (memcached_result_st *result);
35 size_t memcached_result_key_length (const memcached_result_st *result);
37 const char *memcached_result_value (memcached_result_st *ptr);
39 size_t memcached_result_length (const memcached_result_st *ptr);
41 uint32_t memcached_result_flags (const memcached_result_st *result)
43 uint64_t memcached_result_cas (const memcached_result_st *result);
46 memcached_result_set_value (memcached_result_st *ptr,
47 const char *value, size_t length)
49 void memcached_result_set_flags (memcached_result_st *ptr, uint32_t flags)
51 void memcached_result_set_expiration (memcached_result_st *ptr, time_t)
60 libmemcached(3) can optionally return a memcached_result_st which acts as a
61 result object. The result objects have added benefits over the character
62 pointer returns in that they are forward compatible with new return items
63 that future memcached servers may implement (the best current example of
64 this is the CAS return item). The structures can also be reused which will
65 save on calls to malloc(3). It is suggested that you use result objects over
66 char \* return functions.
68 The structure of memcached_result_st has been encapsulated, you should not
69 write code to directly access members of the structure.
71 memcached_result_create() will either allocate memory for a
72 memcached_result_st or will initialize a structure passed to it.
74 memcached_result_free() will deallocate any memory attached to the
75 structure. If the structure was also alloacted, it will deallocate it.
77 memcached_result_key_value() returns the key value associated with the
78 current result object.
80 memcached_result_key_length() returns the key length associated with the
81 current result object.
83 memcached_result_value() returns the result value associated with the
84 current result object.
86 memcached_result_length() returns the result length associated with the
87 current result object.
89 memcached_result_flags() returns the flags associated with the
90 current result object.
92 memcached_result_cas() returns the cas associated with the
93 current result object. This value will only be available if the server
96 memcached_result_set_value() takes a byte array and a size and sets
97 the result to this value. This function is used for trigger responses.
99 void memcached_result_set_flags() takes a result structure and stores
100 a new value for the flags field.
102 void memcached_result_set_expiration(A) takes a result structure and stores
103 a new value for the expiration field (this is only used by read through
106 You may wish to avoid using memcached_result_create(3) with a
107 stack based allocation. The most common issues related to ABI safety involve
108 heap allocated structures.
116 Varies, see particular functions. All structures must have
117 memcached_result_free() called on them for cleanup purposes. Failure to
118 do this will result in leaked memory.
126 To find out more information please check:
127 `http://libmemcached.org/ <http://libmemcached.org/>`_
134 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`