1 .TH "MEMCACHED_MGET_EXECUTE_BY_KEY" "3" "July 05, 2012" "1.0.9" "libmemcached"
3 memcached_mget_execute_by_key \- 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, \fI\%memcached_execute_fn\fP\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, \fI\%memcached_execute_fn\fP\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, \fI\%memcached_execute_fn\fP\fI\ *callback\fP, void\fI\ *context\fP, uint32_t\fI\ number_of_callbacks\fP)
70 .B memcached_return_t (*memcached_execute_fn)(const memcached_st\fI\ *ptr\fP, memcached_result_st\fI\ *result\fP, void\fI\ *context\fP)
73 Compile and link with \-lmemcached
76 \fI\%memcached_get()\fP is used to fetch an individual value from the server.
77 You must pass in a key and its length to fetch the object. You must supply
78 three pointer variables which will give you the state of the returned
79 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
80 the object, and a \fBmemcached_return_t\fP pointer to hold any error. The
81 object will be returned upon success and NULL will be returned on failure. Any
82 object returned by \fI\%memcached_get()\fP must be released by the caller
85 \fI\%memcached_mget()\fP is used to select multiple keys at once. For
86 multiple key operations it is always faster to use this function. This function always works asynchronously.
88 To retrieve data after a successful execution of \fI\%memcached_mget()\fP, you will need to
89 call \fI\%memcached_fetch_result()\fP. You should continue to call this function until
90 it returns a NULL (i.e. no more values). If you need to quit in the middle of a
91 \fI\%memcached_mget()\fP call, you can execute a \fBmemcached_quit()\fP, those this is not required.
93 \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.
94 You must pass in a key and its length to fetch the object. You must supply
95 three pointer variables which will give you the state of the returned
96 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
97 object, and a \fBmemcached_return_t\fP pointer to hold any error. The
98 object will be returned upon success and NULL will be returned on failure. \fBMEMCACHED_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.
100 \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
101 with changes to the server. For more information please refer to the
102 \fBmemcached_result_st\fP help. This function will dynamically allocate a
103 result structure for you if you do not pass one to the function.
105 \fI\%memcached_fetch_execute()\fP is a callback function for result sets.
106 Instead of returning the results to you for processing, it passes each of the
107 result sets to the list of functions you provide. It passes to the function
108 a \fBmemcached_st\fP that can be cloned for use in the called
109 function (it can not be used directly). It also passes a result set which does
110 not need to be freed. Finally it passes a "context". This is just a pointer to
111 a memory reference you supply the calling function. Currently only one value
112 is being passed to each function call. In the future there will be an option
113 to allow this to be an array.
115 \fI\%memcached_mget_execute()\fP and \fI\%memcached_mget_execute_by_key()\fP
116 is similar to \fI\%memcached_mget()\fP, but it may trigger the supplied
117 callbacks with result sets while sending out the queries. If you try to
118 perform a really large multiget with \fI\%memcached_mget()\fP you may
119 encounter a deadlock in the OS kernel (it will fail to write data to the
120 socket because the input buffer is full). \fI\%memcached_mget_execute()\fP
121 solves this problem by processing some of the results before continuing
122 sending out requests. Please note that this function is only available in
125 \fI\%memcached_get_by_key()\fP and \fI\%memcached_mget_by_key()\fP behave
126 in a similar nature as \fI\%memcached_get()\fP and \fI\%memcached_mget()\fP.
127 The difference is that they take a master key that is used for determining
128 which server an object was stored if key partitioning was used for storage.
130 All of the above functions are not tested when the
131 \fBMEMCACHED_BEHAVIOR_USE_UDP\fP has been set. Executing any of these
132 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.
135 All objects retrieved via \fI\%memcached_get()\fP or \fI\%memcached_get_by_key()\fP must be freed with \fIfree(3)\fP.
137 \fI\%memcached_get()\fP will return NULL on
138 error. You must look at the value of error to determine what the actual error
141 \fI\%memcached_fetch_execute()\fP return \fBMEMCACHED_SUCCESS\fP if
142 all keys were successful. \fBMEMCACHED_NOTFOUND\fP will be return if no
143 keys at all were found.
145 \fI\%memcached_fetch_result()\fP sets error
146 to \fBMEMCACHED_END\fP upon successful conclusion.
147 \fBMEMCACHED_NOTFOUND\fP will be return if no keys at all were found.
150 To find out more information please check:
151 \fI\%http://libmemcached.org/\fP
154 \fImemcached(1)\fP \fIlibmemcached(3)\fP \fImemcached_strerror(3)\fP
158 2011, Brian Aker DataDifferential, http://datadifferential.com/
159 .\" Generated by docutils manpage writer.