c751bf084576996f20e3302e4a3de28c1d7b9955
[m6w6/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.0.99 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.0
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 <p class="caption"><span class="caption-text">libmemcached</span></p>
89 <ul class="current">
90 <li class="toctree-l1"><a class="reference internal" href="../libmemcached.html">Introduction</a></li>
91 <li class="toctree-l1 current"><a class="reference internal" href="index.html">libmemcached API</a><ul class="current">
92 <li class="toctree-l2 current"><a class="reference internal" href="index_basics.html">Basics</a><ul class="current">
93 <li class="toctree-l3"><a class="reference internal" href="memcached_create.html">Creating and destroying a memcached_st</a></li>
94 <li class="toctree-l3 current"><a class="current reference internal" href="#">Retrieving data from the server</a></li>
95 <li class="toctree-l3"><a class="reference internal" href="memcached_set.html">Storing data on the server</a></li>
96 <li class="toctree-l3"><a class="reference internal" href="memcached_delete.html">Deleting data from a server</a></li>
97 <li class="toctree-l3"><a class="reference internal" href="memcached_quit.html">Disconnecting a client from a server</a></li>
98 </ul>
99 </li>
100 <li class="toctree-l2"><a class="reference internal" href="index_data.html">Working with Data</a></li>
101 <li class="toctree-l2"><a class="reference internal" href="index_errors.html">Messages and Errors</a></li>
102 <li class="toctree-l2"><a class="reference internal" href="index_advanced.html">Advanced Topics</a></li>
103 <li class="toctree-l2"><a class="reference internal" href="index_deprecated.html">Deprecated Functionality</a></li>
104 </ul>
105 </li>
106 <li class="toctree-l1"><a class="reference internal" href="index_misc.html">Misc</a></li>
107 </ul>
108 <p class="caption"><span class="caption-text">libmemcachedutil</span></p>
109 <ul>
110 <li class="toctree-l1"><a class="reference internal" href="../libmemcachedutil.html">Introduction</a></li>
111 <li class="toctree-l1"><a class="reference internal" href="../libmemcachedutil/index.html">libmemcachedutil API</a></li>
112 </ul>
113 <p class="caption"><span class="caption-text">libhashkit</span></p>
114 <ul>
115 <li class="toctree-l1"><a class="reference internal" href="../libhashkit.html">Introduction</a></li>
116 <li class="toctree-l1"><a class="reference internal" href="../libhashkit/index.html">libhashkit API</a></li>
117 </ul>
118 <p class="caption"><span class="caption-text">Client Applications</span></p>
119 <ul>
120 <li class="toctree-l1"><a class="reference internal" href="../bin/index.html">Client Applications</a></li>
121 </ul>
122 <p class="caption"><span class="caption-text">Copyright</span></p>
123 <ul>
124 <li class="toctree-l1"><a class="reference internal" href="../copyright.html">Copyright</a></li>
125 </ul>
126
127
128
129 </div>
130 </div>
131 </nav>
132
133 <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
134
135
136 <nav class="wy-nav-top" aria-label="top navigation">
137
138 <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
139 <a href="../index.html">libmemcached</a>
140
141 </nav>
142
143
144 <div class="wy-nav-content">
145
146 <div class="rst-content">
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164 <div role="navigation" aria-label="breadcrumbs navigation">
165
166 <ul class="wy-breadcrumbs">
167
168 <li><a href="../index.html">Docs</a> &raquo;</li>
169
170 <li><a href="index.html">libmemcached API</a> &raquo;</li>
171
172 <li><a href="index_basics.html">Basics</a> &raquo;</li>
173
174 <li>Retrieving data from the server</li>
175
176
177 <li class="wy-breadcrumbs-aside">
178
179
180
181 </li>
182
183 </ul>
184
185
186 <hr/>
187 </div>
188 <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
189 <div itemprop="articleBody">
190
191 <div class="section" id="retrieving-data-from-the-server">
192 <h1>Retrieving data from the server<a class="headerlink" href="#retrieving-data-from-the-server" title="Permalink to this headline"></a></h1>
193 <div class="section" id="synopsis">
194 <h2>SYNOPSIS<a class="headerlink" href="#synopsis" title="Permalink to this headline"></a></h2>
195 <dl class="docutils">
196 <dt>#include &lt;libmemcached/memcached.h&gt;</dt>
197 <dd>Compile and link with -lmemcached</dd>
198 </dl>
199 <dl class="function">
200 <dt id="_CPPv422memcached_fetch_resultP12memcached_stP19memcached_result_stP18memcached_return_t">
201 <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>
202 <dd></dd></dl>
203
204 <dl class="function">
205 <dt id="_CPPv413memcached_getP12memcached_stPKc6size_tP6size_tP8uint32_tP18memcached_return_t">
206 <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>
207 <dd></dd></dl>
208
209 <dl class="function">
210 <dt id="_CPPv414memcached_mgetP12memcached_stPPCKcPK6size_t6size_t">
211 <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>
212 <dd></dd></dl>
213
214 <dl class="function">
215 <dt id="_CPPv420memcached_get_by_keyP12memcached_stPKc6size_tPKc6size_tP6size_tP8uint32_tP18memcached_return_t">
216 <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>
217 <dd></dd></dl>
218
219 <dl class="function">
220 <dt id="_CPPv421memcached_mget_by_keyP12memcached_stPKc6size_tPPCKcPK6size_t6size_t">
221 <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>
222 <dd></dd></dl>
223
224 <dl class="function">
225 <dt id="_CPPv423memcached_fetch_executeP12memcached_stP20memcached_execute_fnPv8uint32_t">
226 <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>
227 <dd></dd></dl>
228
229 <dl class="function">
230 <dt id="_CPPv422memcached_mget_executeP12memcached_stPPCKcPK6size_t6size_tP20memcached_execute_fnPv8uint32_t">
231 <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>
232 <dd></dd></dl>
233
234 <dl class="function">
235 <dt id="_CPPv429memcached_mget_execute_by_keyP12memcached_stPKc6size_tPPCKcPK6size_t6size_tP20memcached_execute_fnPv8uint32_t">
236 <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>
237 <dd></dd></dl>
238
239 <dl class="type">
240 <dt id="_CPPv420memcached_execute_fn">
241 <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>
242 <dd></dd></dl>
243
244 </div>
245 <div class="section" id="description">
246 <h2>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
247 <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.
248 You must pass in a key and its length to fetch the object. You must supply
249 three pointer variables which will give you the state of the returned
250 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
251 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
252 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
253 object will be returned upon success and NULL will be returned on failure. Any
254 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
255 application.</p>
256 <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
257 multiple key operations it is always faster to use this function.
258 This function always works asynchronously.</p>
259 <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
260 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
261 this function until it returns a NULL (i.e. no more values). If you need to quit
262 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
263 <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>
264 <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
265 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.
266 You must pass in a key and its length to fetch the object. You must supply
267 three pointer variables which will give you the state of the returned object.
268 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,
269 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
270 <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
271 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
272 returned by the *error value when all objects that have been found have been
273 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>
274 <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>
275 structure from a memcached server. The result object is forward compatible
276 with changes to the server. For more information please refer to the
277 <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
278 result structure for you if you do not pass one to the function.</p>
279 <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.
280 Instead of returning the results to you for processing, it passes each of the
281 result sets to the list of functions you provide. It passes to the function
282 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
283 function (it can not be used directly). It also passes a result set which does
284 not need to be freed. Finally it passes a &quot;context&quot;. This is just a pointer to
285 a memory reference you supply the calling function. Currently only one value
286 is being passed to each function call. In the future there will be an option
287 to allow this to be an array.</p>
288 <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>
289 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
290 callbacks with result sets while sending out the queries. If you try to
291 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
292 encounter a deadlock in the OS kernel (it will fail to write data to the
293 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>
294 solves this problem by processing some of the results before continuing
295 sending out requests. Please note that this function is only available in
296 the binary protocol.</p>
297 <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
298 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>.
299 The difference is that they take a master key that is used for determining
300 which server an object was stored if key partitioning was used for storage.</p>
301 <p>All of the above functions are not tested when the
302 <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
303 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
304 returned, or for those functions which do not return a
305 <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
306 <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>
307 </div>
308 <div class="section" id="return-value">
309 <h2>RETURN VALUE<a class="headerlink" href="#return-value" title="Permalink to this headline"></a></h2>
310 <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>
311 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>
312 <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.
313 You must look at the value of error to determine what the actual error was.</p>
314 <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
315 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
316 keys at all were found.</p>
317 <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
318 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.
319 <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>
320 </div>
321 <div class="section" id="see-also">
322 <h2>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline"></a></h2>
323 <ul class="simple">
324 <li><em class="manpage"><a class="manpage reference external" href="https://linux.die.net/man/1/memcached">memcached(1)</a></em></li>
325 <li><a class="reference internal" href="../libmemcached.html"><span class="doc">C/C++ Client Library for memcached</span></a></li>
326 <li><a class="reference internal" href="memcached_strerror.html"><span class="doc">Converting Error Codes to Messages</span></a></li>
327 </ul>
328 </div>
329 </div>
330
331
332 </div>
333
334 </div>
335 <footer>
336
337 <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
338
339 <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>
340
341
342 <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>
343
344 </div>
345
346
347 <hr/>
348
349 <div role="contentinfo">
350 <p>
351 &copy; <a href="../copyright.html">Copyright</a>
352
353 </p>
354 </div>
355 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>.
356
357 </footer>
358
359 </div>
360 </div>
361
362 </section>
363
364 </div>
365
366
367
368 <script type="text/javascript">
369 jQuery(function () {
370 SphinxRtdTheme.Navigation.enable(true);
371 });
372 </script>
373
374
375
376
377
378
379 </body>
380 </html>