1 .TH "MEMCACHED_FETCH_RESULT" "3" "July 21, 2011" "0.51" "libmemcached"
3 memcached_fetch_result \- Retrieving data from the server
5 .nr rst2man-indent-level 0
9 level \\n[rst2man-indent-level]
10 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
17 .\" .rstReportMargin pre:
19 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
20 . nr rst2man-indent-level +1
21 .\" .rstReportMargin post:
25 .\" indent \\n[an-margin]
26 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
27 .nr rst2man-indent-level -1
28 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
29 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
31 .\" Man page generated from reStructeredText.
35 #include <libmemcached/memcached.h>
38 .B memcached_result_st * memcached_fetch_result(memcached_st\fI\ *ptr\fP, memcached_result_st\fI\ *result\fP, memcached_return_t\fI\ *error\fP)
42 .B char * memcached_get(memcached_st\fI\ *ptr\fP, const char\fI\ *key\fP, size_t\fI\ key_length\fP, size_t\fI\ *value_length\fP, uint32_t\fI\ *flags\fP, memcached_return_t\fI\ *error\fP)
46 .B memcached_return_t memcached_mget(memcached_st\fI\ *ptr\fP, const char * const\fI\ *keys\fP, const size_t\fI\ *key_length\fP, size_t\fI\ number_of_keys\fP)
50 .B char * memcached_get_by_key(memcached_st\fI\ *ptr\fP, const char\fI\ *group_key\fP, size_t\fI\ group_key_length\fP, const char\fI\ *key\fP, size_t\fI\ key_length\fP, size_t\fI\ *value_length\fP, uint32_t\fI\ *flags\fP, memcached_return_t\fI\ *error\fP)
54 .B memcached_return_t memcached_mget_by_key(memcached_st\fI\ *ptr\fP, const char\fI\ *group_key\fP, size_t\fI\ group_key_length\fP, const char * const\fI\ *keys\fP, const size_t\fI\ *key_length\fP, size_t\fI\ number_of_keys\fP)
58 .B memcached_return_t memcached_fetch_execute(memcached_st\fI\ *ptr\fP, memcached_execute_fn\fI\ *callback\fP, void\fI\ *context\fP, uint32_t\fI\ number_of_callbacks\fP)
62 .B memcached_return_t memcached_mget_execute(memcached_st\fI\ *ptr\fP, const char * const\fI\ *keys\fP, const size_t\fI\ *key_length\fP, size_t\fI\ number_of_keys\fP, memcached_execute_fn\fI\ *callback\fP, void\fI\ *context\fP, uint32_t\fI\ number_of_callbacks\fP)
66 .B memcached_return_t memcached_mget_execute_by_key(memcached_st\fI\ *ptr\fP, const char\fI\ *group_key\fP, size_t\fI\ group_key_length\fP, const char * const\fI\ *keys\fP, const size_t\fI\ *key_length\fP, size_t\fI\ number_of_keys\fP, memcached_execute_fn\fI\ *callback\fP, void\fI\ *context\fP, uint32_t\fI\ number_of_callbacks\fP)
69 Compile and link with \-lmemcached
72 \fI\%memcached_get()\fP is used to fetch an individual value from the server.
73 You must pass in a key and its length to fetch the object. You must supply
74 three pointer variables which will give you the state of the returned
75 object. A \fBuint32_t\fP pointer to contain whatever flags you stored with the value, a \fBsize_t\fP pointer which will be filled with size of of
76 the object, and a \fBmemcached_return_t\fP pointer to hold any error. The
77 object will be returned upon success and NULL will be returned on failure. Any
78 object returned by \fI\%memcached_get()\fP must be released by the caller
81 \fI\%memcached_mget()\fP is used to select multiple keys at once. For
82 multiple key operations it is always faster to use this function. This function always works asynchronously.
84 To retrieve data after a successful execution of \fI\%memcached_mget()\fP, you will need to
85 call \fI\%memcached_fetch_result()\fP. You should continue to call this function until
86 it returns a NULL (i.e. no more values). If you need to quit in the middle of a
87 \fI\%memcached_mget()\fP call, you can execute a \fBmemcached_quit()\fP, those this is not required.
89 \fI\%memcached_fetch_result()\fP is used to fetch an individual value from the server. \fI\%memcached_mget()\fP must always be called before using this method.
90 You must pass in a key and its length to fetch the object. You must supply
91 three pointer variables which will give you the state of the returned
92 object. A \fBuint32_t\fP pointer to contain whatever flags you stored with the value, a \fBsize_t\fP pointer which will be filled with size of of the
93 object, and a \fBmemcached_return_t\fP pointer to hold any error. The
94 object will be returned upon success and NULL will be returned on failure. \fBMEMCACHD_END\fP is returned by the *error value when all objects that have been found are returned. The final value upon \fBMEMCACHED_END\fP is null.
96 \fI\%memcached_fetch_result()\fP is used to return a \fBmemcached_result_st\fP structure from a memcached server. The result object is forward compatible
97 with changes to the server. For more information please refer to the
98 \fBmemcached_result_st\fP help. This function will dynamically allocate a
99 result structure for you if you do not pass one to the function.
101 \fI\%memcached_fetch_execute()\fP is a callback function for result sets.
102 Instead of returning the results to you for processing, it passes each of the
103 result sets to the list of functions you provide. It passes to the function
104 a \fBmemcached_st\fP that can be cloned for use in the called
105 function (it can not be used directly). It also passes a result set which does
106 not need to be freed. Finally it passes a "context". This is just a pointer to
107 a memory reference you supply the calling function. Currently only one value
108 is being passed to each function call. In the future there will be an option
109 to allow this to be an array.
111 \fI\%memcached_mget_execute()\fP and \fI\%memcached_mget_execute_by_key()\fP
112 is similar to \fI\%memcached_mget()\fP, but it may trigger the supplied
113 callbacks with result sets while sending out the queries. If you try to
114 perform a really large multiget with \fI\%memcached_mget()\fP you may
115 encounter a deadlock in the OS kernel (it will fail to write data to the
116 socket because the input buffer is full). \fI\%memcached_mget_execute()\fP
117 solves this problem by processing some of the results before continuing
118 sending out requests. Please note that this function is only available in
121 \fI\%memcached_get_by_key()\fP and \fI\%memcached_mget_by_key()\fP behave
122 in a similar nature as \fI\%memcached_get()\fP and \fI\%memcached_mget()\fP.
123 The difference is that they take a master key that is used for determining
124 which server an object was stored if key partitioning was used for storage.
126 All of the above functions are not tested when the
127 \fBMEMCACHED_BEHAVIOR_USE_UDP\fP has been set. Executing any of these
128 functions with this behavior on will result in \fBMEMCACHED_NOT_SUPPORTED\fP being returned, or for those functions which do not return a \fBmemcached_return_t\fP, the error function parameter will be set to \fBMEMCACHED_NOT_SUPPORTED\fP.
131 All objects retrieved via \fI\%memcached_get()\fP or \fI\%memcached_get_by_key()\fP must be freed with \fIfree(3)\fP.
133 \fI\%memcached_get()\fP will return NULL on
134 error. You must look at the value of error to determine what the actual error
137 \fI\%memcached_fetch_execute()\fP return \fBMEMCACHED_SUCCESS\fP if
138 all keys were successful. \fBMEMCACHED_NOTFOUND\fP will be return if no
139 keys at all were found.
141 \fI\%memcached_fetch_result()\fP sets error
142 to \fBMEMCACHED_END\fP upon successful conclusion.
143 \fBMEMCACHED_NOTFOUND\fP will be return if no keys at all were found.
146 To find out more information please check:
147 \fI\%http://libmemcached.org/\fP
150 \fImemcached(1)\fP \fIlibmemcached(3)\fP \fImemcached_strerror(3)\fP
154 2011, Brian Aker DataDifferential, http://datadifferential.com/
155 .\" Generated by docutils manpage writer.