1MEMCACHED_RESULT_FREE(3)     libmemcached-awesome     MEMCACHED_RESULT_FREE(3)
2
3
4

NAME

6       memcached_result_free - Working with result sets
7

SYNOPSIS

9       #include <libmemcached/memcached.h>
10              Compile and link with -lmemcachedutil -lmemcached
11
12       typedef struct memcached_result_st memcached_result_st
13
14       memcached_result_st     *memcached_result_create(memcached_st     *ptr,
15       memcached_result_st *result)
16
17              Parameters
18
19ptr -- pointer to initialized memcached_st struct
20
21result -- pointer to an memcached_result_st instance to
22                       initialize or nullptr to allocate a new instance
23
24              Returns
25                     pointer to initialized memcached_result_st instance
26
27       void memcached_result_free(memcached_result_st *result)
28
29              Parameters
30                     result  --  pointer  to  initialized  memcached_result_st
31                     struct
32
33       const char *memcached_result_key_value(memcached_result_st *result)
34
35              Parameters
36                     result  --  pointer  to  initialized  memcached_result_st
37                     struct
38
39              Returns
40                     the key value associated with the current result object
41
42       size_t memcached_result_key_length(const memcached_result_st *result)
43
44              Parameters
45                     result  --  pointer  to  initialized  memcached_result_st
46                     struct
47
48              Returns
49                     the key length associated with the current result object
50
51       const char *memcached_result_value(memcached_result_st *result)
52
53              Parameters
54                     result  --  pointer  to  initialized  memcached_result_st
55                     struct
56
57              Returns
58                     the  result  value associated with the current result ob‐
59                     ject
60
61       char *memcached_result_take_value(memcached_result_st *result)
62
63              Parameters
64                     result  --  pointer  to  initialized  memcached_result_st
65                     struct
66
67              Returns
68                     the  result  value associated with the current result ob‐
69                     ject
70
71       size_t memcached_result_length(const memcached_result_st *result)
72
73              Parameters
74                     result  --  pointer  to  initialized  memcached_result_st
75                     struct
76
77              Returns
78                     the  result length associated with the current result ob‐
79                     ject
80
81       uint32_t memcached_result_flags(const memcached_result_st *result)
82
83              Parameters
84                     result  --  pointer  to  initialized  memcached_result_st
85                     struct
86
87              Returns
88                     the flags associated with the current result object
89
90       uint64_t memcached_result_cas(const memcached_result_st *result)
91
92              Parameters
93                     result  --  pointer  to  initialized  memcached_result_st
94                     struct
95
96              Returns
97                     the cas associated with the current result object
98
99       memcached_return_t memcached_result_set_value(memcached_result_st  *re‐
100       sult, const char *value, size_t length)
101
102              Parameters
103
104result  --  pointer  to initialized memcached_result_st
105                       struct
106
107value -- byte array to set the value of the current re‐
108                       sult object to
109
110length  --  the length of value wothout any terminating
111                       zero
112
113              Returns
114                     memcached_return_t indicating success
115
116       void memcached_result_set_flags(memcached_result_st  *result,  uint32_t
117       flags)
118
119              Parameters
120
121result  --  pointer  to initialized memcached_result_st
122                       struct
123
124flags -- a new value for the flags field
125
126       void    memcached_result_set_expiration(memcached_result_st    *result,
127       time_t expiration)
128
129              Parameters
130
131result  --  pointer  to initialized memcached_result_st
132                       struct
133
134expiration -- a new value for the expiration field
135

DESCRIPTION

137       libmemcached can optionally return a memcached_result_st which acts  as
138       a  result object. The result objects have added benefits over the char‐
139       acter pointer return values, in that they are forward  compatible  with
140       new  return items that future memcached servers may implement (the best
141       current example of this is the CAS return  item).  The  structures  can
142       also  be reused, which will save on calls to malloc(3). It is suggested
143       that you use result objects over char * return functions.
144
145       The structure of memcached_result_st has been encapsulated, you  should
146       not write code directly accessing members of the structure.
147
148       memcached_result_create()   will   either   allocate   memory   for   a
149       memcached_result_st or will initialize a structure passed to it.
150
151       memcached_result_free() will deallocate  any  memory  attached  to  the
152       structure. If the structure was also allocated, it will deallocate it.
153
154       memcached_result_key_value()  returns the key value associated with the
155       current result object.
156
157       memcached_result_key_length() returns the key  length  associated  with
158       the current result object.
159
160       memcached_result_value()  returns  the result value associated with the
161       current result object.
162
163       memcached_result_take_value() returns and hands over the  result  value
164       associated with the current result object. You must call free(3) to re‐
165       lease this value, unless you have made use of a custom  allocator.  Use
166       of  a  custom allocator requires that you create your own custom free()
167       to release it.
168
169       memcached_result_length() returns the result length associated with the
170       current result object.
171
172       memcached_result_flags()  returns the flags associated with the current
173       result object.
174
175       memcached_result_cas() returns the cas associated with the current  re‐
176       sult object. This value will only be available if the server tests it.
177
178       memcached_result_set_value() takes a byte array and a size and sets the
179       result to this value. This function is used for trigger responses.
180
181       memcached_result_set_flags() takes a result structure and stores a  new
182       value for the flags field.
183
184       memcached_result_set_expiration() takes a result structure and stores a
185       new value for the expiration field (this is only used by  read  through
186       triggers).
187

RETURN VALUE

189       Varies,   see   particular   functions.   All   structures   must  have
190       memcached_result_free() called on them for cleanup purposes. Failure to
191       do this will result in leaked memory.
192

SEE ALSO

194       memcached(1) libmemcached(3) memcached_strerror(3) memcached_memory_al‐
195       locators(3)
196
197
198
199
2001.1                              Nov 09, 2022         MEMCACHED_RESULT_FREE(3)
Impressum