Deploy to GitHub pages
[awesomized/libmemcached] / libmemcached / memcached_server_st.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>Managing lists of servers &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="Managing the servers used by memcached_st" href="memcached_servers.html" />
40 <link rel="prev" title="Servers and Server Lists" href="index_advanced_servers.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"><a class="reference internal" href="index_basics.html">Basics</a></li>
92 <li class="toctree-l2"><a class="reference internal" href="index_data.html">Working with Data</a></li>
93 <li class="toctree-l2"><a class="reference internal" href="index_errors.html">Messages and Errors</a></li>
94 <li class="toctree-l2 current"><a class="reference internal" href="index_advanced.html">Advanced Topics</a><ul class="current">
95 <li class="toctree-l3"><a class="reference internal" href="index_advanced_internals.html">Internal Behavior</a></li>
96 <li class="toctree-l3"><a class="reference internal" href="index_advanced_aeh.html">Authentication, Encryption &amp; Hashing</a></li>
97 <li class="toctree-l3 current"><a class="reference internal" href="index_advanced_servers.html">Servers and Server Lists</a><ul class="current">
98 <li class="toctree-l4 current"><a class="current reference internal" href="#">Managing lists of servers</a></li>
99 <li class="toctree-l4"><a class="reference internal" href="memcached_servers.html">Managing the servers used by memcached_st</a></li>
100 </ul>
101 </li>
102 <li class="toctree-l3"><a class="reference internal" href="index_advanced_daemon.html">Affecting the memcached Daemon</a></li>
103 <li class="toctree-l3"><a class="reference internal" href="index_advanced_stats.html">Statistics</a></li>
104 </ul>
105 </li>
106 <li class="toctree-l2"><a class="reference internal" href="index_deprecated.html">Deprecated Functionality</a></li>
107 </ul>
108 </li>
109 <li class="toctree-l1"><a class="reference internal" href="../libmemcachedutil/index.html">libmemcachedutil API</a></li>
110 <li class="toctree-l1"><a class="reference internal" href="../libhashkit/index.html">libhashkit API</a></li>
111 <li class="toctree-l1"><a class="reference internal" href="../bin/index.html">Client Applications</a></li>
112 <li class="toctree-l1"><a class="reference internal" href="index_misc.html">Miscellaneous</a></li>
113 </ul>
114 <ul>
115 <li class="toctree-l1"><a class="reference internal" href="../changelogs.html">Change Logs</a></li>
116 <li class="toctree-l1"><a class="reference internal" href="../copyright.html">Copyright</a></li>
117 </ul>
118
119
120
121 </div>
122 </div>
123 </nav>
124
125 <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
126
127
128 <nav class="wy-nav-top" aria-label="top navigation">
129
130 <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
131 <a href="../index.html">libmemcached</a>
132
133 </nav>
134
135
136 <div class="wy-nav-content">
137
138 <div class="rst-content">
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156 <div role="navigation" aria-label="breadcrumbs navigation">
157
158 <ul class="wy-breadcrumbs">
159
160 <li><a href="../index.html">Docs</a> &raquo;</li>
161
162 <li><a href="index.html">libmemcached API</a> &raquo;</li>
163
164 <li><a href="index_advanced.html">Advanced Topics</a> &raquo;</li>
165
166 <li><a href="index_advanced_servers.html">Servers and Server Lists</a> &raquo;</li>
167
168 <li>Managing lists of servers</li>
169
170
171 <li class="wy-breadcrumbs-aside">
172
173
174
175 <a href="https://github.com/m6w6/libmemcached/blob/v1.x/docs/source/libmemcached/memcached_server_st.rst" class="fa fa-github"> Edit on GitHub</a>
176
177
178
179 </li>
180
181 </ul>
182
183
184 <hr/>
185 </div>
186 <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
187 <div itemprop="articleBody">
188
189 <div class="section" id="managing-lists-of-servers">
190 <h1>Managing lists of servers<a class="headerlink" href="#managing-lists-of-servers" title="Permalink to this headline"></a></h1>
191 <div class="section" id="synopsis">
192 <h2>SYNOPSIS<a class="headerlink" href="#synopsis" title="Permalink to this headline"></a></h2>
193 <dl class="docutils">
194 <dt>#include &lt;libmemcached/memcached.h&gt;</dt>
195 <dd>Compile and link with -lmemcached</dd>
196 </dl>
197 <dl class="type">
198 <dt id="c.memcached_instance_st">
199 struct <a class="reference internal" href="#c.memcached_instance_st" title="memcached_instance_st">memcached_instance_st</a> <code class="descname">memcached_instance_st</code><a class="headerlink" href="#c.memcached_instance_st" title="Permalink to this definition"></a></dt>
200 <dd></dd></dl>
201
202 <dl class="type">
203 <dt id="c.memcached_server_st">
204 struct <a class="reference internal" href="#c.memcached_server_st" title="memcached_server_st">memcached_server_st</a> <code class="descname">memcached_server_st</code><a class="headerlink" href="#c.memcached_server_st" title="Permalink to this definition"></a></dt>
205 <dd></dd></dl>
206
207 <dl class="type">
208 <dt id="c.memcached_server_list_st">
209 struct <a class="reference internal" href="#c.memcached_server_st" title="memcached_server_st">memcached_server_st</a> *<code class="descname">memcached_server_list_st</code><a class="headerlink" href="#c.memcached_server_list_st" title="Permalink to this definition"></a></dt>
210 <dd></dd></dl>
211
212 <dl class="function">
213 <dt id="_CPPv426memcached_server_list_free24memcached_server_list_st">
214 <span id="_CPPv326memcached_server_list_free24memcached_server_list_st"></span><span id="_CPPv226memcached_server_list_free24memcached_server_list_st"></span><span id="memcached_server_list_free__memcached_server_list_st"></span>void <code class="descname">memcached_server_list_free</code><span class="sig-paren">(</span>memcached_server_list_st <em>list</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv426memcached_server_list_free24memcached_server_list_st" title="Permalink to this definition"></a><br /></dt>
215 <dd><table class="docutils field-list" frame="void" rules="none">
216 <col class="field-name" />
217 <col class="field-body" />
218 <tbody valign="top">
219 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>list</strong> -- instance of initialized <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">memcached_server_list_st</span></code> object</td>
220 </tr>
221 </tbody>
222 </table>
223 </dd></dl>
224
225 <dl class="function">
226 <dt id="_CPPv428memcached_server_list_append24memcached_server_list_stPKc9in_port_tP18memcached_return_t">
227 <span id="_CPPv328memcached_server_list_append24memcached_server_list_stPKc9in_port_tP18memcached_return_t"></span><span id="_CPPv228memcached_server_list_append24memcached_server_list_stPKc9in_port_tP18memcached_return_t"></span><span id="memcached_server_list_append__memcached_server_list_st.cCP.in_port_t.memcached_return_tP"></span>memcached_server_list_st <code class="descname">memcached_server_list_append</code><span class="sig-paren">(</span>memcached_server_list_st <em>list</em>, <em class="property">const</em> char *<em>hostname</em>, in_port_t <em>port</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="#_CPPv428memcached_server_list_append24memcached_server_list_stPKc9in_port_tP18memcached_return_t" title="Permalink to this definition"></a><br /></dt>
228 <dd><table class="docutils field-list" frame="void" rules="none">
229 <col class="field-name" />
230 <col class="field-body" />
231 <tbody valign="top">
232 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
233 <li><strong>list</strong> -- instance of an existing <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">memcached_server_list_st</span></code> or nullptr to create one</li>
234 <li><strong>hostname</strong> -- the hostname or path to the socket, defaults to localhost if null</li>
235 <li><strong>port</strong> -- the port to use, defaults to 11211 if 0</li>
236 <li><strong>error</strong> -- pointer to store any <a class="reference internal" href="memcached_return_t.html#_CPPv418memcached_return_t" title="memcached_return_t"><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">memcached_return_t</span></code></a> error indicating success</li>
237 </ul>
238 </td>
239 </tr>
240 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">new instance of <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">memcached_server_list_st</span></code> on success or nullptr on failure</p>
241 </td>
242 </tr>
243 </tbody>
244 </table>
245 </dd></dl>
246
247 <dl class="function">
248 <dt id="_CPPv427memcached_server_list_count24memcached_server_list_st">
249 <span id="_CPPv327memcached_server_list_count24memcached_server_list_st"></span><span id="_CPPv227memcached_server_list_count24memcached_server_list_st"></span><span id="memcached_server_list_count__memcached_server_list_st"></span>uint32_t <code class="descname">memcached_server_list_count</code><span class="sig-paren">(</span>memcached_server_list_st <em>list</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv427memcached_server_list_count24memcached_server_list_st" title="Permalink to this definition"></a><br /></dt>
250 <dd><table class="docutils field-list" frame="void" rules="none">
251 <col class="field-name" />
252 <col class="field-body" />
253 <tbody valign="top">
254 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>list</strong> -- instance of <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">memcached_server_list_st</span></code></td>
255 </tr>
256 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">count of servers in the list</td>
257 </tr>
258 </tbody>
259 </table>
260 </dd></dl>
261
262 <dl class="function">
263 <dt id="_CPPv422memcached_server_errorPK21memcached_instance_st">
264 <span id="_CPPv322memcached_server_errorPK21memcached_instance_st"></span><span id="_CPPv222memcached_server_errorPK21memcached_instance_st"></span><span id="memcached_server_error__memcached_instance_stCP"></span><em class="property">const</em> char *<code class="descname">memcached_server_error</code><span class="sig-paren">(</span><em class="property">const</em> memcached_instance_st *<em>instance</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv422memcached_server_errorPK21memcached_instance_st" title="Permalink to this definition"></a><br /></dt>
265 <dd><table class="docutils field-list" frame="void" rules="none">
266 <col class="field-name" />
267 <col class="field-body" />
268 <tbody valign="top">
269 <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>instance</strong> -- pointer to an initialized <code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">memcached_instance_st</span></code> object</td>
270 </tr>
271 <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">last error message sent from the server to the client</td>
272 </tr>
273 </tbody>
274 </table>
275 </dd></dl>
276
277 <dl class="function">
278 <dt id="_CPPv428memcached_server_error_resetPK21memcached_instance_st">
279 <span id="_CPPv328memcached_server_error_resetPK21memcached_instance_st"></span><span id="_CPPv228memcached_server_error_resetPK21memcached_instance_st"></span><span id="memcached_server_error_reset__memcached_instance_stCP"></span>void <code class="descname">memcached_server_error_reset</code><span class="sig-paren">(</span><em class="property">const</em> memcached_instance_st *<em>list</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv428memcached_server_error_resetPK21memcached_instance_st" title="Permalink to this definition"></a><br /></dt>
280 <dd><div class="deprecated">
281 <p><span class="versionmodified">Deprecated since version 0.39.</span></p>
282 </div>
283 </dd></dl>
284
285 <dl class="function">
286 <dt id="_CPPv423memcached_servers_parsev">
287 <span id="_CPPv323memcached_servers_parsev"></span><span id="_CPPv223memcached_servers_parsev"></span><span id="memcached_servers_parse"></span>void <code class="descname">memcached_servers_parse</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv423memcached_servers_parsev" title="Permalink to this definition"></a><br /></dt>
288 <dd><div class="deprecated">
289 <p><span class="versionmodified">Deprecated since version 0.39.</span></p>
290 </div>
291 <p>See <a class="reference internal" href="configuration.html#_CPPv49memcachedPKc6size_t" title="memcached"><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">memcached()</span></code></a>.</p>
292 </dd></dl>
293
294 </div>
295 <div class="section" id="description">
296 <h2>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
297 <p><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">libmemcached</span></code> operates on a list of hosts which are stored in
298 <code class="xref cpp cpp-type docutils literal notranslate"><span class="pre">memcached_server_st</span></code> structures. You should not modify these structures
299 directly. Functions are provided to modify these structures.</p>
300 <p><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_server_list()</span></code> is used to provide an array of all defined hosts.
301 This was incorrectly documented as &quot;requiring free&quot; up till version 0.39.</p>
302 <p><a class="reference internal" href="#_CPPv426memcached_server_list_free24memcached_server_list_st" title="memcached_server_list_free"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_server_list_free()</span></code></a> deallocates all memory associated with the
303 array of <code class="xref cpp cpp-type docutils literal notranslate"><span class="pre">memcached_server_st</span></code> that you passed to it.</p>
304 <p><a class="reference internal" href="#_CPPv428memcached_server_list_append24memcached_server_list_stPKc9in_port_tP18memcached_return_t" title="memcached_server_list_append"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_server_list_append()</span></code></a> adds a server to the end of a
305 <code class="xref cpp cpp-type docutils literal notranslate"><span class="pre">memcached_server_st</span></code> array. On error null will be returned and the
306 <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 you passed into the function will be set with the appropriate error. If the value of port is zero, it is set to the default
307 port of a memcached server.</p>
308 <p>DEPRECATED <a class="reference internal" href="#_CPPv423memcached_servers_parsev" title="memcached_servers_parse"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_servers_parse()</span></code></a>, please see <a class="reference internal" href="configuration.html#_CPPv49memcachedPKc6size_t" title="memcached"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached()</span></code></a></p>
309 <p><a class="reference internal" href="#_CPPv422memcached_server_errorPK21memcached_instance_st" title="memcached_server_error"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_server_error()</span></code></a> can be used to look at the text of the last
310 error message sent by the server to to the client.</p>
311 <p>Before version 0.39 theses functions used a memcached_server_st *. In 0.39
312 memcached_server_st * was aliased to <code class="xref cpp cpp-type docutils literal notranslate"><span class="pre">memcached_server_list_st</span></code>.
313 This was done for a style reason to help clean up some concepts in the code.</p>
314 </div>
315 <div class="section" id="return-value">
316 <h2>RETURN VALUE<a class="headerlink" href="#return-value" title="Permalink to this headline"></a></h2>
317 <p>Varies, see particular functions.</p>
318 </div>
319 <div class="section" id="see-also">
320 <h2>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline"></a></h2>
321 <ul class="simple">
322 <li><em class="manpage"><a class="manpage reference external" href="https://linux.die.net/man/1/memcached">memcached(1)</a></em></li>
323 <li><a class="reference internal" href="../libmemcached.html"><span class="doc">C/C++ Client Library for memcached</span></a></li>
324 <li><a class="reference internal" href="memcached_servers.html"><span class="doc">Managing the servers used by memcached_st</span></a></li>
325 <li><a class="reference internal" href="memcached_strerror.html"><span class="doc">Converting Error Codes to Messages</span></a></li>
326 </ul>
327 </div>
328 </div>
329
330
331 </div>
332
333 </div>
334 <footer>
335
336 <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
337
338 <a href="memcached_servers.html" class="btn btn-neutral float-right" title="Managing the servers used by memcached_st" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
339
340
341 <a href="index_advanced_servers.html" class="btn btn-neutral float-left" title="Servers and Server Lists" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
342
343 </div>
344
345
346 <hr/>
347
348 <div role="contentinfo">
349 <p>
350 &copy; <a href="../copyright.html">Copyright</a>
351
352 </p>
353 </div>
354 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>.
355
356 </footer>
357
358 </div>
359 </div>
360
361 </section>
362
363 </div>
364
365
366
367 <script type="text/javascript">
368 jQuery(function () {
369 SphinxRtdTheme.Navigation.enable(true);
370 });
371 </script>
372
373
374
375
376
377
378 </body>
379 </html>