Merge in more updates for docs (we are just going to check them all in so that users...
[awesomized/libmemcached] / docs / memcached_result_st.rst
1 .. highlight:: perl
2
3
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 ******************************************************************************************************************************************************************************************************
6
7
8 Work with memcached_result_st
9
10
11 *******
12 LIBRARY
13 *******
14
15
16 C Client Library for memcached (libmemcached, -lmemcached)
17
18
19 ********
20 SYNOPSIS
21 ********
22
23
24
25 .. code-block:: perl
26
27 #include <libmemcached/memcached.h>
28
29 memcached_result_st *
30 memcached_result_create (memcached_st *ptr,
31 memcached_result_st *result);
32
33 void memcached_result_free (memcached_result_st *result);
34
35 const char * memcached_result_key_value (memcached_result_st *result);
36
37 size_t memcached_result_key_length (const memcached_result_st *result);
38
39 const char *memcached_result_value (memcached_result_st *ptr);
40
41 size_t memcached_result_length (const memcached_result_st *ptr);
42
43 uint32_t memcached_result_flags (const memcached_result_st *result)
44
45 uint64_t memcached_result_cas (const memcached_result_st *result);
46
47 memcached_return_t
48 memcached_result_set_value (memcached_result_st *ptr,
49 const char *value, size_t length)
50
51 void memcached_result_set_flags (memcached_result_st *ptr, uint32_t flags)
52
53 void memcached_result_set_expiration (memcached_result_st *ptr, time_t)
54
55
56
57 ***********
58 DESCRIPTION
59 ***********
60
61
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.
69
70 The structure of memcached_result_st has been encapsulated, you should not
71 write code to directly access members of the structure.
72
73 memcached_result_create() will either allocate memory for a
74 memcached_result_st or will initialize a structure passed to it.
75
76 memcached_result_free() will deallocate any memory attached to the
77 structure. If the structure was also alloacted, it will deallocate it.
78
79 memcached_result_key_value() returns the key value associated with the
80 current result object.
81
82 memcached_result_key_length() returns the key length associated with the
83 current result object.
84
85 memcached_result_value() returns the result value associated with the
86 current result object.
87
88 memcached_result_length() returns the result length associated with the
89 current result object.
90
91 memcached_result_flags() returns the flags associated with the
92 current result object.
93
94 memcached_result_cas() returns the cas associated with the
95 current result object. This value will only be available if the server
96 supports it.
97
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.
100
101 void memcached_result_set_flags() takes a result structure and stores
102 a new value for the flags field.
103
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
106 triggers).
107
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.
111
112
113 ******
114 RETURN
115 ******
116
117
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.
121
122
123 ****
124 HOME
125 ****
126
127
128 To find out more information please check:
129 `https://launchpad.net/libmemcached <https://launchpad.net/libmemcached>`_
130
131
132 ******
133 AUTHOR
134 ******
135
136
137 Brian Aker, <brian@tangent.org>
138
139
140 ********
141 SEE ALSO
142 ********
143
144
145 memcached(1) libmemcached(3) memcached_strerror(3)
146