4 memcached_result_create, memcached_result_free, memcached_result_key_value, memcached_result_key_length, memcached_result_value, memcached_result_length, memcached_result_flags, memcached_result_cas
5 ******************************************************************************************************************************************************************************************************
8 Work with memcached_result_st
16 C Client Library for memcached (libmemcached, -lmemcached)
27 #include <libmemcached/memcached.h>
30 memcached_result_create (memcached_st *ptr,
31 memcached_result_st *result);
33 void memcached_result_free (memcached_result_st *result);
35 const char * memcached_result_key_value (memcached_result_st *result);
37 size_t memcached_result_key_length (const memcached_result_st *result);
39 const char *memcached_result_value (memcached_result_st *ptr);
41 size_t memcached_result_length (const memcached_result_st *ptr);
43 uint32_t memcached_result_flags (const memcached_result_st *result)
45 uint64_t memcached_result_cas (const memcached_result_st *result);
48 memcached_result_set_value (memcached_result_st *ptr,
49 const char *value, size_t length)
51 void memcached_result_set_flags (memcached_result_st *ptr, uint32_t flags)
53 void memcached_result_set_expiration (memcached_result_st *ptr, time_t)
62 libmemcached(3) can optionally return a memcached_result_st which acts as a
63 result object. The result objects have added benefits over the character
64 pointer returns in that they are forward compatible with new return items
65 that future memcached servers may implement (the best current example of
66 this is the CAS return item). The structures can also be reused which will
67 save on calls to malloc(3). It is suggested that you use result objects over
68 char \* return functions.
70 The structure of memcached_result_st has been encapsulated, you should not
71 write code to directly access members of the structure.
73 memcached_result_create() will either allocate memory for a
74 memcached_result_st or will initialize a structure passed to it.
76 memcached_result_free() will deallocate any memory attached to the
77 structure. If the structure was also alloacted, it will deallocate it.
79 memcached_result_key_value() returns the key value associated with the
80 current result object.
82 memcached_result_key_length() returns the key length associated with the
83 current result object.
85 memcached_result_value() returns the result value associated with the
86 current result object.
88 memcached_result_length() returns the result length associated with the
89 current result object.
91 memcached_result_flags() returns the flags associated with the
92 current result object.
94 memcached_result_cas() returns the cas associated with the
95 current result object. This value will only be available if the server
98 memcached_result_set_value() takes a byte array and a size and sets
99 the result to this value. This function is used for trigger responses.
101 void memcached_result_set_flags() takes a result structure and stores
102 a new value for the flags field.
104 void memcached_result_set_expiration(A) takes a result structure and stores
105 a new value for the expiration field (this is only used by read through
108 You may wish to avoid using memcached_result_create(3) with a
109 stack based allocation. The most common issues related to ABI safety involve
110 heap allocated structures.
118 Varies, see particular functions. All structures must have
119 memcached_result_free() called on them for cleanup purposes. Failure to
120 do this will result in leaked memory.
128 To find out more information please check:
129 `https://launchpad.net/libmemcached <https://launchpad.net/libmemcached>`_
137 Brian Aker, <brian@tangent.org>
145 memcached(1) libmemcached(3) memcached_strerror(3)