Deploy to GitHub pages
[awesomized/libmemcached] / libmemcached / memcached_get.html
1
2
3 <!DOCTYPE html>
4 <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
5 <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
6 <head>
7 <meta charset="utf-8">
8
9 <meta name="viewport" content="width=device-width, initial-scale=1.0">
10
11 <title>Retrieving data from the server &mdash; libmemcached 1.1.0 documentation</title>
12
13
14
15
16
17
18
19
20 <script type="text/javascript" src="../_static/js/modernizr.min.js"></script>
21
22
23 <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
24 <script type="text/javascript" src="../_static/jquery.js"></script>
25 <script type="text/javascript" src="../_static/underscore.js"></script>
26 <script type="text/javascript" src="../_static/doctools.js"></script>
27 <script type="text/javascript" src="../_static/language_data.js"></script>
28
29 <script type="text/javascript" src="../_static/js/theme.js"></script>
30
31
32
33
34 <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
35 <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
36 <link rel="index" title="Index" href="../genindex.html" />
37 <link rel="search" title="Search" href="../search.html" />
38 <link rel="copyright" title="Copyright" href="../copyright.html" />
39 <link rel="next" title="Storing data on the server" href="memcached_set.html" />
40 <link rel="prev" title="Creating and destroying a memcached_st" href="memcached_create.html" />
41 </head>
42
43 <body class="wy-body-for-nav">
44
45
46 <div class="wy-grid-for-nav">
47
48 <nav data-toggle="wy-nav-shift" class="wy-nav-side">
49 <div class="wy-side-scroll">
50 <div class="wy-side-nav-search" >
51
52
53
54 <a href="../index.html" class="icon icon-home"> libmemcached
55
56
57
58 </a>
59
60
61
62
63 <div class="version">
64 1.1
65 </div>
66
67
68
69
70 <div role="search">
71 <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
72 <input type="text" name="q" placeholder="Search docs" />
73 <input type="hidden" name="check_keywords" value="yes" />
74 <input type="hidden" name="area" value="default" />
75 </form>
76 </div>
77
78
79 </div>
80
81 <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
82
83
84
85
86
87
88 <ul class="current">
89 <li class="toctree-l1"><a class="reference internal" href="../libmemcached.html">Introduction</a></li>
90 <li class="toctree-l1 current"><a class="reference internal" href="index.html">libmemcached API</a><ul class="current">
91 <li class="toctree-l2 current"><a class="reference internal" href="index_basics.html">Basics</a><ul class="current">
92 <li class="toctree-l3"><a class="reference internal" href="memcached_create.html">Creating and destroying a memcached_st</a></li>
93 <li class="toctree-l3 current"><a class="current reference internal" href="#">Retrieving data from the server</a></li>
94 <li class="toctree-l3"><a class="reference internal" href="memcached_set.html">Storing data on the server</a></li>
95 <li class="toctree-l3"><a class="reference internal" href="memcached_delete.html">Deleting data from a server</a></li>
96 <li class="toctree-l3"><a class="reference internal" href="memcached_quit.html">Disconnecting a client from a server</a></li>
97 </ul>
98 </li>
99 <li class="toctree-l2"><a class="reference internal" href="index_data.html">Working with Data</a></li>
100 <li class="toctree-l2"><a class="reference internal" href="index_errors.html">Messages and Errors</a></li>
101 <li class="toctree-l2"><a class="reference internal" href="index_advanced.html">Advanced Topics</a></li>
102 <li class="toctree-l2"><a class="reference internal" href="index_deprecated.html">Deprecated Functionality</a></li>
103 </ul>
104 </li>
105 <li class="toctree-l1"><a class="reference internal" href="../libmemcachedutil/index.html">libmemcachedutil API</a></li>
106 <li class="toctree-l1"><a class="reference internal" href="../libhashkit/index.html">libhashkit API</a></li>
107 <li class="toctree-l1"><a class="reference internal" href="../bin/index.html">Client Applications</a></li>
108 <li class="toctree-l1"><a class="reference internal" href="index_misc.html">Miscellaneous</a></li>
109 </ul>
110 <ul>
111 <li class="toctree-l1"><a class="reference internal" href="../changelogs.html">Change Logs</a></li>
112 <li class="toctree-l1"><a class="reference internal" href="../copyright.html">Copyright</a></li>
113 </ul>
114
115
116
117 </div>
118 </div>
119 </nav>
120
121 <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
122
123
124 <nav class="wy-nav-top" aria-label="top navigation">
125
126 <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
127 <a href="../index.html">libmemcached</a>
128
129 </nav>
130
131
132 <div class="wy-nav-content">
133
134 <div class="rst-content">
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152 <div role="navigation" aria-label="breadcrumbs navigation">
153
154 <ul class="wy-breadcrumbs">
155
156 <li><a href="../index.html">Docs</a> &raquo;</li>
157
158 <li><a href="index.html">libmemcached API</a> &raquo;</li>
159
160 <li><a href="index_basics.html">Basics</a> &raquo;</li>
161
162 <li>Retrieving data from the server</li>
163
164
165 <li class="wy-breadcrumbs-aside">
166
167
168
169 <a href="https://github.com/m6w6/libmemcached/blob/v1.x/docs/source/libmemcached/memcached_get.rst" class="fa fa-github"> Edit on GitHub</a>
170
171
172
173 </li>
174
175 </ul>
176
177
178 <hr/>
179 </div>
180 <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
181 <div itemprop="articleBody">
182
183 <div class="section" id="retrieving-data-from-the-server">
184 <h1>Retrieving data from the server<a class="headerlink" href="#retrieving-data-from-the-server" title="Permalink to this headline"></a></h1>
185 <div class="section" id="synopsis">
186 <h2>SYNOPSIS<a class="headerlink" href="#synopsis" title="Permalink to this headline"></a></h2>
187 <dl class="docutils">
188 <dt>#include &lt;libmemcached/memcached.h&gt;</dt>
189 <dd>Compile and link with -lmemcached</dd>
190 </dl>
191 <dl class="function">
192 <dt id="_CPPv422memcached_fetch_resultP12memcached_stP19memcached_result_stP18memcached_return_t">
193 <span id="_CPPv322memcached_fetch_resultP12memcached_stP19memcached_result_stP18memcached_return_t"></span><span id="_CPPv222memcached_fetch_resultP12memcached_stP19memcached_result_stP18memcached_return_t"></span><span id="memcached_fetch_result__memcached_stP.memcached_result_stP.memcached_return_tP"></span><a class="reference internal" href="memcached_result_st.html#_CPPv419memcached_result_st" title="memcached_result_st">memcached_result_st</a> *<code class="descname">memcached_fetch_result</code><span class="sig-paren">(</span><a class="reference internal" href="memcached_create.html#_CPPv412memcached_st" title="memcached_st">memcached_st</a> *<em>ptr</em>, <a class="reference internal" href="memcached_result_st.html#_CPPv419memcached_result_st" title="memcached_result_st">memcached_result_st</a> *<em>result</em>, <a class="reference internal" href="memcached_return_t.html#_CPPv418memcached_return_t" title="memcached_return_t">memcached_return_t</a> *<em>error</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv422memcached_fetch_resultP12memcached_stP19memcached_result_stP18memcached_return_t" title="Permalink to this definition"></a><br /></dt>
194 <dd></dd></dl>
195
196 <dl class="function">
197 <dt id="_CPPv413memcached_getP12memcached_stPKc6size_tP6size_tP8uint32_tP18memcached_return_t">
198 <span id="_CPPv313memcached_getP12memcached_stPKc6size_tP6size_tP8uint32_tP18memcached_return_t"></span><span id="_CPPv213memcached_getP12memcached_stPKc6size_tP6size_tP8uint32_tP18memcached_return_t"></span><span id="memcached_get__memcached_stP.cCP.s.sP.uint32_tP.memcached_return_tP"></span>char *<code class="descname">memcached_get</code><span class="sig-paren">(</span><a class="reference internal" href="memcached_create.html#_CPPv412memcached_st" title="memcached_st">memcached_st</a> *<em>ptr</em>, <em class="property">const</em> char *<em>key</em>, size_t <em>key_length</em>, size_t *<em>value_length</em>, uint32_t *<em>flags</em>, <a class="reference internal" href="memcached_return_t.html#_CPPv418memcached_return_t" title="memcached_return_t">memcached_return_t</a> *<em>error</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv413memcached_getP12memcached_stPKc6size_tP6size_tP8uint32_tP18memcached_return_t" title="Permalink to this definition"></a><br /></dt>
199 <dd></dd></dl>
200
201 <dl class="function">
202 <dt id="_CPPv414memcached_mgetP12memcached_stPPCKcPK6size_t6size_t">
203 <span id="_CPPv314memcached_mgetP12memcached_stPPCKcPK6size_t6size_t"></span><span id="_CPPv214memcached_mgetP12memcached_stPPCKcPK6size_t6size_t"></span><span id="memcached_mget__memcached_stP.cCPCP.sCP.s"></span><a class="reference internal" href="memcached_return_t.html#_CPPv418memcached_return_t" title="memcached_return_t">memcached_return_t</a> <code class="descname">memcached_mget</code><span class="sig-paren">(</span><a class="reference internal" href="memcached_create.html#_CPPv412memcached_st" title="memcached_st">memcached_st</a> *<em>ptr</em>, <em class="property">const</em> char *<em class="property">const</em> *<em>keys</em>, <em class="property">const</em> size_t *<em>key_length</em>, size_t <em>number_of_keys</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv414memcached_mgetP12memcached_stPPCKcPK6size_t6size_t" title="Permalink to this definition"></a><br /></dt>
204 <dd></dd></dl>
205
206 <dl class="function">
207 <dt id="_CPPv420memcached_get_by_keyP12memcached_stPKc6size_tPKc6size_tP6size_tP8uint32_tP18memcached_return_t">
208 <span id="_CPPv320memcached_get_by_keyP12memcached_stPKc6size_tPKc6size_tP6size_tP8uint32_tP18memcached_return_t"></span><span id="_CPPv220memcached_get_by_keyP12memcached_stPKc6size_tPKc6size_tP6size_tP8uint32_tP18memcached_return_t"></span><span id="memcached_get_by_key__memcached_stP.cCP.s.cCP.s.sP.uint32_tP.memcached_return_tP"></span>char *<code class="descname">memcached_get_by_key</code><span class="sig-paren">(</span><a class="reference internal" href="memcached_create.html#_CPPv412memcached_st" title="memcached_st">memcached_st</a> *<em>ptr</em>, <em class="property">const</em> char *<em>group_key</em>, size_t <em>group_key_length</em>, <em class="property">const</em> char *<em>key</em>, size_t <em>key_length</em>, size_t *<em>value_length</em>, uint32_t *<em>flags</em>, <a class="reference internal" href="memcached_return_t.html#_CPPv418memcached_return_t" title="memcached_return_t">memcached_return_t</a> *<em>error</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv420memcached_get_by_keyP12memcached_stPKc6size_tPKc6size_tP6size_tP8uint32_tP18memcached_return_t" title="Permalink to this definition"></a><br /></dt>
209 <dd></dd></dl>
210
211 <dl class="function">
212 <dt id="_CPPv421memcached_mget_by_keyP12memcached_stPKc6size_tPPCKcPK6size_t6size_t">
213 <span id="_CPPv321memcached_mget_by_keyP12memcached_stPKc6size_tPPCKcPK6size_t6size_t"></span><span id="_CPPv221memcached_mget_by_keyP12memcached_stPKc6size_tPPCKcPK6size_t6size_t"></span><span id="memcached_mget_by_key__memcached_stP.cCP.s.cCPCP.sCP.s"></span><a class="reference internal" href="memcached_return_t.html#_CPPv418memcached_return_t" title="memcached_return_t">memcached_return_t</a> <code class="descname">memcached_mget_by_key</code><span class="sig-paren">(</span><a class="reference internal" href="memcached_create.html#_CPPv412memcached_st" title="memcached_st">memcached_st</a> *<em>ptr</em>, <em class="property">const</em> char *<em>group_key</em>, size_t <em>group_key_length</em>, <em class="property">const</em> char *<em class="property">const</em> *<em>keys</em>, <em class="property">const</em> size_t *<em>key_length</em>, size_t <em>number_of_keys</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv421memcached_mget_by_keyP12memcached_stPKc6size_tPPCKcPK6size_t6size_t" title="Permalink to this definition"></a><br /></dt>
214 <dd></dd></dl>
215
216 <dl class="function">
217 <dt id="_CPPv423memcached_fetch_executeP12memcached_stP20memcached_execute_fnPv8uint32_t">
218 <span id="_CPPv323memcached_fetch_executeP12memcached_stP20memcached_execute_fnPv8uint32_t"></span><span id="_CPPv223memcached_fetch_executeP12memcached_stP20memcached_execute_fnPv8uint32_t"></span><span id="memcached_fetch_execute__memcached_stP.memcached_execute_fnP.voidP.uint32_t"></span><a class="reference internal" href="memcached_return_t.html#_CPPv418memcached_return_t" title="memcached_return_t">memcached_return_t</a> <code class="descname">memcached_fetch_execute</code><span class="sig-paren">(</span><a class="reference internal" href="memcached_create.html#_CPPv412memcached_st" title="memcached_st">memcached_st</a> *<em>ptr</em>, <a class="reference internal" href="#_CPPv420memcached_execute_fn" title="memcached_execute_fn">memcached_execute_fn</a> *<em>callback</em>, void *<em>context</em>, uint32_t <em>number_of_callbacks</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv423memcached_fetch_executeP12memcached_stP20memcached_execute_fnPv8uint32_t" title="Permalink to this definition"></a><br /></dt>
219 <dd></dd></dl>
220
221 <dl class="function">
222 <dt id="_CPPv422memcached_mget_executeP12memcached_stPPCKcPK6size_t6size_tP20memcached_execute_fnPv8uint32_t">
223 <span id="_CPPv322memcached_mget_executeP12memcached_stPPCKcPK6size_t6size_tP20memcached_execute_fnPv8uint32_t"></span><span id="_CPPv222memcached_mget_executeP12memcached_stPPCKcPK6size_t6size_tP20memcached_execute_fnPv8uint32_t"></span><span id="memcached_mget_execute__memcached_stP.cCPCP.sCP.s.memcached_execute_fnP.voidP.uint32_t"></span><a class="reference internal" href="memcached_return_t.html#_CPPv418memcached_return_t" title="memcached_return_t">memcached_return_t</a> <code class="descname">memcached_mget_execute</code><span class="sig-paren">(</span><a class="reference internal" href="memcached_create.html#_CPPv412memcached_st" title="memcached_st">memcached_st</a> *<em>ptr</em>, <em class="property">const</em> char *<em class="property">const</em> *<em>keys</em>, <em class="property">const</em> size_t *<em>key_length</em>, size_t <em>number_of_keys</em>, <a class="reference internal" href="#_CPPv420memcached_execute_fn" title="memcached_execute_fn">memcached_execute_fn</a> *<em>callback</em>, void *<em>context</em>, uint32_t <em>number_of_callbacks</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv422memcached_mget_executeP12memcached_stPPCKcPK6size_t6size_tP20memcached_execute_fnPv8uint32_t" title="Permalink to this definition"></a><br /></dt>
224 <dd></dd></dl>
225
226 <dl class="function">
227 <dt id="_CPPv429memcached_mget_execute_by_keyP12memcached_stPKc6size_tPPCKcPK6size_t6size_tP20memcached_execute_fnPv8uint32_t">
228 <span id="_CPPv329memcached_mget_execute_by_keyP12memcached_stPKc6size_tPPCKcPK6size_t6size_tP20memcached_execute_fnPv8uint32_t"></span><span id="_CPPv229memcached_mget_execute_by_keyP12memcached_stPKc6size_tPPCKcPK6size_t6size_tP20memcached_execute_fnPv8uint32_t"></span><span id="memcached_mget_execute_by_key__memcached_stP.cCP.s.cCPCP.sCP.s.memcached_execute_fnP.voidP.uint32_t"></span><a class="reference internal" href="memcached_return_t.html#_CPPv418memcached_return_t" title="memcached_return_t">memcached_return_t</a> <code class="descname">memcached_mget_execute_by_key</code><span class="sig-paren">(</span><a class="reference internal" href="memcached_create.html#_CPPv412memcached_st" title="memcached_st">memcached_st</a> *<em>ptr</em>, <em class="property">const</em> char *<em>group_key</em>, size_t <em>group_key_length</em>, <em class="property">const</em> char *<em class="property">const</em> *<em>keys</em>, <em class="property">const</em> size_t *<em>key_length</em>, size_t <em>number_of_keys</em>, <a class="reference internal" href="#_CPPv420memcached_execute_fn" title="memcached_execute_fn">memcached_execute_fn</a> *<em>callback</em>, void *<em>context</em>, uint32_t <em>number_of_callbacks</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv429memcached_mget_execute_by_keyP12memcached_stPKc6size_tPPCKcPK6size_t6size_tP20memcached_execute_fnPv8uint32_t" title="Permalink to this definition"></a><br /></dt>
229 <dd></dd></dl>
230
231 <dl class="type">
232 <dt id="_CPPv420memcached_execute_fn">
233 <span id="_CPPv320memcached_execute_fn"></span><span id="_CPPv220memcached_execute_fn"></span><span id="memcached_execute_fn"></span><em class="property">typedef </em><a class="reference internal" href="memcached_return_t.html#_CPPv418memcached_return_t" title="memcached_return_t">memcached_return_t</a> (*<code class="descname">memcached_execute_fn</code>)<span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="memcached_create.html#_CPPv412memcached_st" title="memcached_st">memcached_st</a> *ptr, <a class="reference internal" href="memcached_result_st.html#_CPPv419memcached_result_st" title="memcached_result_st">memcached_result_st</a> *result, void *context<span class="sig-paren">)</span><a class="headerlink" href="#_CPPv420memcached_execute_fn" title="Permalink to this definition"></a><br /></dt>
234 <dd></dd></dl>
235
236 </div>
237 <div class="section" id="description">
238 <h2>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
239 <p><a class="reference internal" href="#_CPPv413memcached_getP12memcached_stPKc6size_tP6size_tP8uint32_tP18memcached_return_t" title="memcached_get"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_get()</span></code></a> is used to fetch an individual value from the server.
240 You must pass in a key and its length to fetch the object. You must supply
241 three pointer variables which will give you the state of the returned
242 object. A <code class="xref cpp cpp-type docutils literal notranslate"><span class="pre">uint32_t</span></code> pointer to contain whatever flags you stored
243 with the value, a <code class="xref cpp cpp-type docutils literal notranslate"><span class="pre">size_t</span></code> pointer which will be filled with size of of
244 the object, and a <a class="reference internal" href="memcached_return_t.html#_CPPv418memcached_return_t" title="memcached_return_t"><code class="xref cpp cpp-type docutils literal notranslate"><span class="pre">memcached_return_t</span></code></a> pointer to hold any error. The
245 object will be returned upon success and NULL will be returned on failure. Any
246 object returned by <a class="reference internal" href="#_CPPv413memcached_getP12memcached_stPKc6size_tP6size_tP8uint32_tP18memcached_return_t" title="memcached_get"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_get()</span></code></a> must be released by the caller
247 application.</p>
248 <p><a class="reference internal" href="#_CPPv414memcached_mgetP12memcached_stPPCKcPK6size_t6size_t" title="memcached_mget"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_mget()</span></code></a> is used to select multiple keys at once. For
249 multiple key operations it is always faster to use this function.
250 This function always works asynchronously.</p>
251 <p>To retrieve data after a successful execution of <a class="reference internal" href="#_CPPv414memcached_mgetP12memcached_stPPCKcPK6size_t6size_t" title="memcached_mget"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_mget()</span></code></a>, you
252 will need to call <a class="reference internal" href="#_CPPv422memcached_fetch_resultP12memcached_stP19memcached_result_stP18memcached_return_t" title="memcached_fetch_result"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_fetch_result()</span></code></a>. You should continue to call
253 this function until it returns a NULL (i.e. no more values). If you need to quit
254 in the middle of a <a class="reference internal" href="#_CPPv414memcached_mgetP12memcached_stPPCKcPK6size_t6size_t" title="memcached_mget"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_mget()</span></code></a> call, you can execute a
255 <a class="reference internal" href="memcached_quit.html#_CPPv414memcached_quitP12memcached_st" title="memcached_quit"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_quit()</span></code></a>, those this is not required.</p>
256 <p><a class="reference internal" href="#_CPPv422memcached_fetch_resultP12memcached_stP19memcached_result_stP18memcached_return_t" title="memcached_fetch_result"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_fetch_result()</span></code></a> is used to fetch an individual value from the
257 server. <a class="reference internal" href="#_CPPv414memcached_mgetP12memcached_stPPCKcPK6size_t6size_t" title="memcached_mget"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_mget()</span></code></a> must always be called before using this method.
258 You must pass in a key and its length to fetch the object. You must supply
259 three pointer variables which will give you the state of the returned object.
260 A <code class="xref cpp cpp-type docutils literal notranslate"><span class="pre">uint32_t</span></code> pointer to contain whatever flags you stored with the value,
261 a <code class="xref cpp cpp-type docutils literal notranslate"><span class="pre">size_t</span></code> pointer which will be filled with size of of the object, and a
262 <a class="reference internal" href="memcached_return_t.html#_CPPv418memcached_return_t" title="memcached_return_t"><code class="xref cpp cpp-type docutils literal notranslate"><span class="pre">memcached_return_t</span></code></a> pointer to hold any error. The object will be
263 returned upon success and NULL will be returned on failure. <a class="reference internal" href="memcached_return_t.html#_CPPv4N18memcached_return_t13MEMCACHED_ENDE" title="MEMCACHED_END"><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">MEMCACHED_END</span></code></a> is
264 returned by the *error value when all objects that have been found have been
265 returned. The final value upon <a class="reference internal" href="memcached_return_t.html#_CPPv4N18memcached_return_t13MEMCACHED_ENDE" title="MEMCACHED_END"><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">MEMCACHED_END</span></code></a> is null.</p>
266 <p><a class="reference internal" href="#_CPPv422memcached_fetch_resultP12memcached_stP19memcached_result_stP18memcached_return_t" title="memcached_fetch_result"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_fetch_result()</span></code></a> is used to return a <a class="reference internal" href="memcached_result_st.html#_CPPv419memcached_result_st" title="memcached_result_st"><code class="xref cpp cpp-type docutils literal notranslate"><span class="pre">memcached_result_st</span></code></a>
267 structure from a memcached server. The result object is forward compatible
268 with changes to the server. For more information please refer to the
269 <a class="reference internal" href="memcached_result_st.html#_CPPv419memcached_result_st" title="memcached_result_st"><code class="xref cpp cpp-type docutils literal notranslate"><span class="pre">memcached_result_st</span></code></a> help. This function will dynamically allocate a
270 result structure for you if you do not pass one to the function.</p>
271 <p><a class="reference internal" href="#_CPPv423memcached_fetch_executeP12memcached_stP20memcached_execute_fnPv8uint32_t" title="memcached_fetch_execute"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_fetch_execute()</span></code></a> is a callback function for result sets.
272 Instead of returning the results to you for processing, it passes each of the
273 result sets to the list of functions you provide. It passes to the function
274 a <a class="reference internal" href="memcached_create.html#_CPPv412memcached_st" title="memcached_st"><code class="xref cpp cpp-type docutils literal notranslate"><span class="pre">memcached_st</span></code></a> that can be cloned for use in the called
275 function (it can not be used directly). It also passes a result set which does
276 not need to be freed. Finally it passes a &quot;context&quot;. This is just a pointer to
277 a memory reference you supply the calling function. Currently only one value
278 is being passed to each function call. In the future there will be an option
279 to allow this to be an array.</p>
280 <p><a class="reference internal" href="#_CPPv422memcached_mget_executeP12memcached_stPPCKcPK6size_t6size_tP20memcached_execute_fnPv8uint32_t" title="memcached_mget_execute"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_mget_execute()</span></code></a> and <a class="reference internal" href="#_CPPv429memcached_mget_execute_by_keyP12memcached_stPKc6size_tPPCKcPK6size_t6size_tP20memcached_execute_fnPv8uint32_t" title="memcached_mget_execute_by_key"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_mget_execute_by_key()</span></code></a>
281 is similar to <a class="reference internal" href="#_CPPv414memcached_mgetP12memcached_stPPCKcPK6size_t6size_t" title="memcached_mget"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_mget()</span></code></a>, but it may trigger the supplied
282 callbacks with result sets while sending out the queries. If you try to
283 perform a really large multiget with <a class="reference internal" href="#_CPPv414memcached_mgetP12memcached_stPPCKcPK6size_t6size_t" title="memcached_mget"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_mget()</span></code></a> you may
284 encounter a deadlock in the OS kernel (it will fail to write data to the
285 socket because the input buffer is full). <a class="reference internal" href="#_CPPv422memcached_mget_executeP12memcached_stPPCKcPK6size_t6size_tP20memcached_execute_fnPv8uint32_t" title="memcached_mget_execute"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_mget_execute()</span></code></a>
286 solves this problem by processing some of the results before continuing
287 sending out requests. Please note that this function is only available in
288 the binary protocol.</p>
289 <p><a class="reference internal" href="#_CPPv420memcached_get_by_keyP12memcached_stPKc6size_tPKc6size_tP6size_tP8uint32_tP18memcached_return_t" title="memcached_get_by_key"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_get_by_key()</span></code></a> and <a class="reference internal" href="#_CPPv421memcached_mget_by_keyP12memcached_stPKc6size_tPPCKcPK6size_t6size_t" title="memcached_mget_by_key"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_mget_by_key()</span></code></a> behave
290 in a similar nature as <a class="reference internal" href="#_CPPv413memcached_getP12memcached_stPKc6size_tP6size_tP8uint32_tP18memcached_return_t" title="memcached_get"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_get()</span></code></a> and <a class="reference internal" href="#_CPPv414memcached_mgetP12memcached_stPPCKcPK6size_t6size_t" title="memcached_mget"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_mget()</span></code></a>.
291 The difference is that they take a master key that is used for determining
292 which server an object was stored if key partitioning was used for storage.</p>
293 <p>All of the above functions are not tested when the
294 <a class="reference internal" href="memcached_behavior.html#_CPPv4N20memcached_behavior_t26MEMCACHED_BEHAVIOR_USE_UDPE" title="MEMCACHED_BEHAVIOR_USE_UDP"><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">MEMCACHED_BEHAVIOR_USE_UDP</span></code></a> has been set. Executing any of these
295 functions with this behavior on will result in <a class="reference internal" href="memcached_return_t.html#_CPPv4N18memcached_return_t23MEMCACHED_NOT_SUPPORTEDE" title="MEMCACHED_NOT_SUPPORTED"><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">MEMCACHED_NOT_SUPPORTED</span></code></a> being
296 returned, or for those functions which do not return a
297 <a class="reference internal" href="memcached_return_t.html#_CPPv418memcached_return_t" title="memcached_return_t"><code class="xref cpp cpp-type docutils literal notranslate"><span class="pre">memcached_return_t</span></code></a>, the error function parameter will be set to
298 <a class="reference internal" href="memcached_return_t.html#_CPPv4N18memcached_return_t23MEMCACHED_NOT_SUPPORTEDE" title="MEMCACHED_NOT_SUPPORTED"><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">MEMCACHED_NOT_SUPPORTED</span></code></a>.</p>
299 </div>
300 <div class="section" id="return-value">
301 <h2>RETURN VALUE<a class="headerlink" href="#return-value" title="Permalink to this headline"></a></h2>
302 <p>All objects retrieved via <a class="reference internal" href="#_CPPv413memcached_getP12memcached_stPKc6size_tP6size_tP8uint32_tP18memcached_return_t" title="memcached_get"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_get()</span></code></a> or <a class="reference internal" href="#_CPPv420memcached_get_by_keyP12memcached_stPKc6size_tPKc6size_tP6size_tP8uint32_tP18memcached_return_t" title="memcached_get_by_key"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_get_by_key()</span></code></a>
303 must be freed with <em class="manpage"><a class="manpage reference external" href="https://linux.die.net/man/3/free">free(3)</a></em>.</p>
304 <p><a class="reference internal" href="#_CPPv413memcached_getP12memcached_stPKc6size_tP6size_tP8uint32_tP18memcached_return_t" title="memcached_get"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_get()</span></code></a> will return NULL on error.
305 You must look at the value of error to determine what the actual error was.</p>
306 <p><a class="reference internal" href="#_CPPv423memcached_fetch_executeP12memcached_stP20memcached_execute_fnPv8uint32_t" title="memcached_fetch_execute"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_fetch_execute()</span></code></a> return <a class="reference internal" href="memcached_return_t.html#_CPPv4N18memcached_return_t17MEMCACHED_SUCCESSE" title="MEMCACHED_SUCCESS"><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">MEMCACHED_SUCCESS</span></code></a> if
307 all keys were successful. <a class="reference internal" href="memcached_return_t.html#_CPPv4N18memcached_return_t18MEMCACHED_NOTFOUNDE" title="MEMCACHED_NOTFOUND"><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">MEMCACHED_NOTFOUND</span></code></a> will be returned if no
308 keys at all were found.</p>
309 <p><a class="reference internal" href="#_CPPv422memcached_fetch_resultP12memcached_stP19memcached_result_stP18memcached_return_t" title="memcached_fetch_result"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_fetch_result()</span></code></a> sets error
310 to <a class="reference internal" href="memcached_return_t.html#_CPPv4N18memcached_return_t13MEMCACHED_ENDE" title="MEMCACHED_END"><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">MEMCACHED_END</span></code></a> upon successful conclusion.
311 <a class="reference internal" href="memcached_return_t.html#_CPPv4N18memcached_return_t18MEMCACHED_NOTFOUNDE" title="MEMCACHED_NOTFOUND"><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">MEMCACHED_NOTFOUND</span></code></a> will be returned if no keys at all were found.</p>
312 </div>
313 <div class="section" id="see-also">
314 <h2>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline"></a></h2>
315 <ul class="simple">
316 <li><em class="manpage"><a class="manpage reference external" href="https://linux.die.net/man/1/memcached">memcached(1)</a></em></li>
317 <li><a class="reference internal" href="../libmemcached.html"><span class="doc">C/C++ Client Library for memcached</span></a></li>
318 <li><a class="reference internal" href="memcached_strerror.html"><span class="doc">Converting Error Codes to Messages</span></a></li>
319 </ul>
320 </div>
321 </div>
322
323
324 </div>
325
326 </div>
327 <footer>
328
329 <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
330
331 <a href="memcached_set.html" class="btn btn-neutral float-right" title="Storing data on the server" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
332
333
334 <a href="memcached_create.html" class="btn btn-neutral float-left" title="Creating and destroying a memcached_st" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
335
336 </div>
337
338
339 <hr/>
340
341 <div role="contentinfo">
342 <p>
343 &copy; <a href="../copyright.html">Copyright</a>
344
345 </p>
346 </div>
347 Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
348
349 </footer>
350
351 </div>
352 </div>
353
354 </section>
355
356 </div>
357
358
359
360 <script type="text/javascript">
361 jQuery(function () {
362 SphinxRtdTheme.Navigation.enable(true);
363 });
364 </script>
365
366
367
368
369
370
371 </body>
372 </html>