1 .TH "MEMCACHED_MGET" "3" "April 09, 2011" "0.47" "libmemcached"
3 memcached_mget \- 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 *ptr, memcached_result_st *result, memcached_return_t *error);
42 .B char * memcached_get (memcached_st *ptr, const char *key, size_t key_length, size_t *value_length, uint32_t *flags, memcached_return_t *error);
46 .B memcached_return_t memcached_mget (memcached_st *ptr, const char * const *keys, const size_t *key_length, size_t number_of_keys);
50 .B char * memcached_get_by_key (memcached_st *ptr, const char *master_key, size_t master_key_length, const char *key, size_t key_length, size_t *value_length, uint32_t *flags, memcached_return_t *error);
54 .B memcached_return_t memcached_mget_by_key (memcached_st *ptr, const char *master_key, size_t master_key_length, const char * const *keys, const size_t *key_length, size_t number_of_keys);
58 .B char * memcached_fetch (memcached_st *ptr, char *key, size_t *key_length, size_t *value_length, uint32_t *flags, memcached_return_t *error);
62 .B memcached_return_t memcached_fetch_execute (memcached_st *ptr, memcached_execute_fn *callback, void *context, uint32_t number_of_callbacks);
66 .B memcached_return_t memcached_mget_execute (memcached_st *ptr, const char * const *keys, const size_t *key_length, size_t number_of_keys, memcached_execute_fn *callback, void *context, uint32_t number_of_callbacks);
70 .B memcached_return_t memcached_mget_execute_by_key (memcached_st *ptr, const char *master_key, size_t master_key_length, const char * const *keys, const size_t *key_length, size_t number_of_keys, memcached_execute_fn *callback, void *context, uint32_t number_of_callbacks);
73 Compile and link with \-lmemcached
76 memcached_get() is used to fetch an individual value from the server. You
77 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 uint32_t pointer to contain whatever flags you stored with the value,
80 a size_t pointer which will be filled with size of of the object, and a
81 memcached_return_t pointer to hold any error. The object will be returned
82 upon success and NULL will be returned on failure. Any object returned by
83 memcached_get() must be released by the caller application.
85 memcached_mget() is used to select multiple keys at once. For multiple key
86 operations it is always faster to use this function. This function always
87 works asynchronously. memcached_fetch() is then used to retrieve any keys
88 found. No error is given on keys that are not found. You must call either
89 memcached_fetch() or memcached_fetch_result() after a successful call to
90 memcached_mget(). You should continue to call these functions until they
91 return NULL (aka no more values). If you need to quit in the middle of a
92 memcached_get() call, execute a memcached_quit(). After you do this, you can
93 issue new queries against the server.
95 memcached_fetch() is used to fetch an individual value from the server.
96 memcached_mget() must always be called before using this method. You
97 must pass in a key and its length to fetch the object. You must supply
98 three pointer variables which will give you the state of the returned
99 object. A uint32_t pointer to contain whatever flags you stored with the value,
100 a size_t pointer which will be filled with size of of the object, and a
101 memcached_return_t pointer to hold any error. The object will be returned
102 upon success and NULL will be returned on failure. MEMCACHD_END is returned
103 by the *error value when all objects that have been found are returned.
104 The final value upon MEMCACHED_END is null. Values returned by
105 memcached_fetch() musted be free\(aqed by the caller. memcached_fetch() will
106 be DEPRECATED in the near future, memcached_fetch_result() should be used
109 memcached_fetch_result() is used to return a memcached_result_st(3) structure
110 from a memcached server. The result object is forward compatible with changes
111 to the server. For more information please refer to the memcached_result_st(3)
112 help. This function will dynamically allocate a result structure for you
113 if you do not pass one to the function.
115 memcached_fetch_execute() is a callback function for result sets. Instead
116 of returning the results to you for processing, it passes each of the
117 result sets to the list of functions you provide. It passes to the function
118 a memcached_st that can be cloned for use in the called function (it can not
119 be used directly). It also passes a result set which does not need to be freed.
120 Finally it passes a "context". This is just a pointer to a memory reference
121 you supply the calling function. Currently only one value is being passed
122 to each function call. In the future there will be an option to allow this
125 memcached_mget_execute() and memcached_mget_execute_by_key() is
126 similar to memcached_mget(), but it may trigger the supplied callbacks
127 with result sets while sending out the queries. If you try to perform
128 a really large multiget with memcached_mget() you may encounter a
129 deadlock in the OS kernel (we fail to write data to the socket because
130 the input buffer is full). memcached_mget_execute() solves this
131 problem by processing some of the results before continuing sending
132 out requests. Please note that this function is only available in the
135 memcached_get_by_key() and memcached_mget_by_key() behave in a similar nature
136 as memcached_get() and memcached_mget(). The difference is that they take
137 a master key that is used for determining which server an object was stored
138 if key partitioning was used for storage.
140 All of the above functions are not testsed when the \fBMEMCACHED_BEHAVIOR_USE_UDP\fPhas been set. Executing any of these functions with this behavior on will result in
141 \fBMEMCACHED_NOT_SUPPORTED\fP being returned or, for those functions which do not return
142 a \fBmemcached_return_t\fP, the error function parameter will be set to
143 \fBMEMCACHED_NOT_SUPPORTED\fP.
146 All objects returned must be freed by the calling application.
147 memcached_get() and memcached_fetch() will return NULL on error. You must
148 look at the value of error to determine what the actual error was.
150 MEMCACHED_KEY_TOO_BIG is set to error whenever memcached_fetch() was used
151 and the key was set larger then MEMCACHED_MAX_KEY, which was the largest
152 key allowed for the original memcached ascii server.
155 To find out more information please check:
156 \fI\%https://launchpad.net/libmemcached\fP
159 \fImemcached(1)\fP \fIlibmemcached(3)\fP \fImemcached_strerror(3)\fP
163 2011, Brian Aker DataDifferential, http://datadifferential.com/
164 .\" Generated by docutils manpage writer.