3 memcached_result_create, memcached_result_free,
4 memcached_result_key_value, memcached_result_key_length,
5 memcached_result_value, memcached_result_length,
6 memcached_result_flags, memcached_result_cas - Work with memcached_result_st
11 C Client Library for memcached (libmemcached, -lmemcached)
15 #include <memcached.h>
18 memcached_result_create (memcached_st *ptr,
19 memcached_result_st *result);
21 void memcached_result_free (memcached_result_st *result);
23 const char * memcached_result_key_value (memcached_result_st *result);
25 size_t memcached_result_key_length (const memcached_result_st *result);
27 const char *memcached_result_value (memcached_result_st *ptr);
29 size_t memcached_result_length (const memcached_result_st *ptr);
31 uint32_t memcached_result_flags (const memcached_result_st *result)
33 uint64_t memcached_result_cas (const memcached_result_st *result);
36 memcached_result_set_value (memcached_result_st *ptr,
37 const char *value, size_t length)
39 void memcached_result_set_flags (memcached_result_st *ptr, uint32_t flags)
41 void memcached_result_set_expiration (memcached_result_st *ptr, time_t)
45 libmemcached(3) can optionally return a memcached_result_st which acts as a
46 result object. The result objects have added benefits over the character
47 pointer returns in that they are forward compatible with new return items
48 that future memcached servers may implement (the best current example of
49 this is the CAS return item). The structures can also be reused which will
50 save on calls to malloc(3). It is suggested that you use result objects over
51 char * return functions.
53 The structure of memcached_result_st has been encapsulated, you should not
54 write code to directly access members of the structure.
56 memcached_result_create() will either allocate memory for a
57 memcached_result_st or will initialize a structure passed to it.
59 memcached_result_free() will deallocate any memory attached to the
60 structure. If the structure was also alloacted, it will deallocate it.
62 memcached_result_key_value() returns the key value associated with the
63 current result object.
65 memcached_result_key_length() returns the key length associated with the
66 current result object.
68 memcached_result_value() returns the result value associated with the
69 current result object.
71 memcached_result_length() returns the result length associated with the
72 current result object.
74 memcached_result_flags() returns the flags associated with the
75 current result object.
77 memcached_result_cas() returns the cas associated with the
78 current result object. This value will only be available if the server
81 memcached_result_set_value() takes a byte array and a size and sets
82 the result to this value. This function is used for trigger responses.
84 void memcached_result_set_flags() takes a result structure and stores
85 a new value for the flags field.
87 void memcached_result_set_expiration(A) takes a result structure and stores
88 a new value for the expiration field (this is only used by read through
91 You may wish to avoid using memcached_result_create(3) with a
92 stack based allocation. The most common issues related to ABI safety involve
93 heap allocated structures.
97 Varies, see particular functions. All structures must have
98 memcached_result_free() called on them for cleanup purposes. Failure to
99 do this will result in leaked memory.
103 To find out more information please check:
104 L<https://launchpad.net/libmemcached>
108 Brian Aker, E<lt>brian@tangent.orgE<gt>
112 memcached(1) libmemcached(3) memcached_strerror(3)