4 <html class=
"writer-html5" lang=
"en" >
8 <meta name=
"viewport" content=
"width=device-width, initial-scale=1.0">
10 <title>Managing lists of servers
— libmemcached
1.0.99 documentation
</title>
14 <link rel=
"stylesheet" href=
"../_static/css/theme.css" type=
"text/css" />
15 <link rel=
"stylesheet" href=
"../_static/pygments.css" type=
"text/css" />
24 <script src="../_static/js/html5shiv.min.js"></script>
28 <script type=
"text/javascript" id=
"documentation_options" data-url_root=
"../" src=
"../_static/documentation_options.js"></script>
29 <script src=
"../_static/jquery.js"></script>
30 <script src=
"../_static/underscore.js"></script>
31 <script src=
"../_static/doctools.js"></script>
32 <script src=
"../_static/language_data.js"></script>
34 <script type=
"text/javascript" src=
"../_static/js/theme.js"></script>
37 <link rel=
"index" title=
"Index" href=
"../genindex.html" />
38 <link rel=
"search" title=
"Search" href=
"../search.html" />
39 <link rel=
"copyright" title=
"Copyright" href=
"../copyright.html" />
40 <link rel=
"next" title=
"Manipulate the server information stored in memcached_st" href=
"memcached_servers.html" />
41 <link rel=
"prev" title=
"Servers and Server Lists" href=
"index_advanced_servers.html" />
44 <body class=
"wy-body-for-nav">
47 <div class=
"wy-grid-for-nav">
49 <nav data-toggle=
"wy-nav-shift" class=
"wy-nav-side">
50 <div class=
"wy-side-scroll">
51 <div class=
"wy-side-nav-search" >
55 <a href=
"../index.html" class=
"icon icon-home" alt=
"Documentation Home"> libmemcached
72 <form id=
"rtd-search-form" class=
"wy-form" action=
"../search.html" method=
"get">
73 <input type=
"text" name=
"q" placeholder=
"Search docs" />
74 <input type=
"hidden" name=
"check_keywords" value=
"yes" />
75 <input type=
"hidden" name=
"area" value=
"default" />
83 <div class=
"wy-menu wy-menu-vertical" data-spy=
"affix" role=
"navigation" aria-label=
"main navigation">
90 <p class=
"caption"><span class=
"caption-text">libmemcached
</span></p>
92 <li class=
"toctree-l1"><a class=
"reference internal" href=
"../libmemcached.html">Introduction
</a></li>
93 <li class=
"toctree-l1 current"><a class=
"reference internal" href=
"index.html">libmemcached API
</a><ul class=
"current">
94 <li class=
"toctree-l2"><a class=
"reference internal" href=
"index_basics.html">Basics
</a></li>
95 <li class=
"toctree-l2"><a class=
"reference internal" href=
"index_data.html">Working with Data
</a></li>
96 <li class=
"toctree-l2"><a class=
"reference internal" href=
"index_errors.html">Messages and Errors
</a></li>
97 <li class=
"toctree-l2 current"><a class=
"reference internal" href=
"index_advanced.html">Advanced Topics
</a><ul class=
"current">
98 <li class=
"toctree-l3"><a class=
"reference internal" href=
"index_advanced_internals.html">Internal Behavior
</a></li>
99 <li class=
"toctree-l3"><a class=
"reference internal" href=
"index_advanced_aeh.html">Authentication, Encryption
& Hashing
</a></li>
100 <li class=
"toctree-l3 current"><a class=
"reference internal" href=
"index_advanced_servers.html">Servers and Server Lists
</a><ul class=
"current">
101 <li class=
"toctree-l4 current"><a class=
"current reference internal" href=
"#">Managing lists of servers
</a></li>
102 <li class=
"toctree-l4"><a class=
"reference internal" href=
"memcached_servers.html">Manipulate the server information stored in memcached_st
</a></li>
105 <li class=
"toctree-l3"><a class=
"reference internal" href=
"index_advanced_daemon.html">Affecting the memcached Daemon
</a></li>
106 <li class=
"toctree-l3"><a class=
"reference internal" href=
"index_advanced_stats.html">Statistics
</a></li>
109 <li class=
"toctree-l2"><a class=
"reference internal" href=
"index_deprecated.html">Deprecated Functionality
</a></li>
112 <li class=
"toctree-l1"><a class=
"reference internal" href=
"index_misc.html">Misc
</a></li>
114 <p class=
"caption"><span class=
"caption-text">libmemcachedutil
</span></p>
116 <li class=
"toctree-l1"><a class=
"reference internal" href=
"../libmemcachedutil.html">Introduction
</a></li>
117 <li class=
"toctree-l1"><a class=
"reference internal" href=
"../libmemcachedutil/index.html">libmemcachedutil API
</a></li>
119 <p class=
"caption"><span class=
"caption-text">libhashkit
</span></p>
121 <li class=
"toctree-l1"><a class=
"reference internal" href=
"../libhashkit.html">Introduction
</a></li>
122 <li class=
"toctree-l1"><a class=
"reference internal" href=
"../libhashkit/index.html">libhashkit API
</a></li>
124 <p class=
"caption"><span class=
"caption-text">Client Applications
</span></p>
126 <li class=
"toctree-l1"><a class=
"reference internal" href=
"../bin/index.html">Client Applications
</a></li>
128 <p class=
"caption"><span class=
"caption-text">Copyright
</span></p>
130 <li class=
"toctree-l1"><a class=
"reference internal" href=
"../copyright.html">Copyright
</a></li>
140 <section data-toggle=
"wy-nav-shift" class=
"wy-nav-content-wrap">
143 <nav class=
"wy-nav-top" aria-label=
"top navigation">
145 <i data-toggle=
"wy-nav-top" class=
"fa fa-bars"></i>
146 <a href=
"../index.html">libmemcached
</a>
151 <div class=
"wy-nav-content">
153 <div class=
"rst-content">
171 <div role=
"navigation" aria-label=
"breadcrumbs navigation">
173 <ul class=
"wy-breadcrumbs">
175 <li><a href=
"../index.html" class=
"icon icon-home"></a> »</li>
177 <li><a href=
"index.html">libmemcached API
</a> »</li>
179 <li><a href=
"index_advanced.html">Advanced Topics
</a> »</li>
181 <li><a href=
"index_advanced_servers.html">Servers and Server Lists
</a> »</li>
183 <li>Managing lists of servers
</li>
186 <li class=
"wy-breadcrumbs-aside">
197 <div role=
"main" class=
"document" itemscope=
"itemscope" itemtype=
"http://schema.org/Article">
198 <div itemprop=
"articleBody">
200 <div class=
"section" id=
"managing-lists-of-servers">
201 <h1>Managing lists of servers
<a class=
"headerlink" href=
"#managing-lists-of-servers" title=
"Permalink to this headline">¶
</a></h1>
202 <div class=
"section" id=
"synopsis">
203 <h2>SYNOPSIS
<a class=
"headerlink" href=
"#synopsis" title=
"Permalink to this headline">¶
</a></h2>
205 <dt>#include
<libmemcached/memcached.h
></dt><dd><p>Compile and link with -lmemcached
</p>
209 <dt id=
"c.memcached_instance_st">
210 <em class=
"property">typedef
</em><em class=
"property">struct
</em> <a class=
"reference internal" href=
"#c.memcached_instance_st" title=
"memcached_instance_st">memcached_instance_st
</a> <code class=
"sig-name descname">memcached_instance_st
</code><a class=
"headerlink" href=
"#c.memcached_instance_st" title=
"Permalink to this definition">¶
</a><br /></dt>
214 <dt id=
"c.memcached_server_st">
215 <em class=
"property">typedef
</em><em class=
"property">struct
</em> <a class=
"reference internal" href=
"#c.memcached_server_st" title=
"memcached_server_st">memcached_server_st
</a> <code class=
"sig-name descname">memcached_server_st
</code><a class=
"headerlink" href=
"#c.memcached_server_st" title=
"Permalink to this definition">¶
</a><br /></dt>
219 <dt id=
"c.memcached_server_list_st">
220 <em class=
"property">typedef
</em><em class=
"property">struct
</em> <a class=
"reference internal" href=
"#c.memcached_server_st" title=
"memcached_server_st">memcached_server_st
</a> *
<code class=
"sig-name descname">memcached_server_list_st
</code><a class=
"headerlink" href=
"#c.memcached_server_list_st" title=
"Permalink to this definition">¶
</a><br /></dt>
223 <dl class=
"cpp function">
224 <dt id=
"_CPPv421memcached_server_listP12memcached_st">
225 <span id=
"_CPPv321memcached_server_listP12memcached_st"></span><span id=
"_CPPv221memcached_server_listP12memcached_st"></span><span id=
"memcached_server_list__memcached_stP"></span><em class=
"property">const
</em> memcached_instance_st *
<code class=
"sig-name descname">memcached_server_list
</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><span class=
"sig-paren">)
</span><a class=
"headerlink" href=
"#_CPPv421memcached_server_listP12memcached_st" title=
"Permalink to this definition">¶
</a><br /></dt>
226 <dd><dl class=
"field-list simple">
227 <dt class=
"field-odd">Parameters
</dt>
228 <dd class=
"field-odd"><p><strong>ptr
</strong> -- pointer to initialized
<a class=
"reference internal" href=
"memcached_create.html#_CPPv412memcached_st" title=
"memcached_st"><code class=
"xref cpp cpp-any docutils literal notranslate"><span class=
"pre">memcached_st
</span></code></a> struct
</p>
230 <dt class=
"field-even">Returns
</dt>
231 <dd class=
"field-even"><p>list of
<code class=
"xref cpp cpp-any docutils literal notranslate"><span class=
"pre">memcached_instance_st
</span></code> objects
</p>
236 <dl class=
"cpp function">
237 <dt id=
"_CPPv426memcached_server_list_free24memcached_server_list_st">
238 <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=
"sig-name 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>
239 <dd><dl class=
"field-list simple">
240 <dt class=
"field-odd">Parameters
</dt>
241 <dd class=
"field-odd"><p><strong>list
</strong> --
</p>
246 <dl class=
"cpp function">
247 <dt id=
"_CPPv428memcached_server_list_append24memcached_server_list_stPKc9in_port_tP18memcached_return_t">
248 <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=
"sig-name 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>
251 <dl class=
"cpp function">
252 <dt id=
"_CPPv427memcached_server_list_count24memcached_server_list_st">
253 <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=
"sig-name 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>
256 <dl class=
"cpp function">
257 <dt id=
"_CPPv422memcached_server_errorPK21memcached_instance_st">
258 <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=
"sig-name 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>
261 <dl class=
"cpp function">
262 <dt id=
"_CPPv428memcached_server_error_resetPK21memcached_instance_st">
263 <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=
"sig-name 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>
264 <dd><div class=
"deprecated">
265 <p><span class=
"versionmodified deprecated">Deprecated since version
0.39.
</span></p>
269 <dl class=
"cpp function">
270 <dt id=
"_CPPv423memcached_servers_parsev">
271 <span id=
"_CPPv323memcached_servers_parsev"></span><span id=
"_CPPv223memcached_servers_parsev"></span><span id=
"memcached_servers_parse"></span>void
<code class=
"sig-name 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>
272 <dd><div class=
"deprecated">
273 <p><span class=
"versionmodified deprecated">Deprecated since version
0.39.
</span></p>
278 <div class=
"section" id=
"description">
279 <h2>DESCRIPTION
<a class=
"headerlink" href=
"#description" title=
"Permalink to this headline">¶
</a></h2>
280 <p>libmemcached(
3) operates on a list of hosts which are stored in
281 <code class=
"xref cpp cpp-type docutils literal notranslate"><span class=
"pre">memcached_server_st
</span></code> structures. You should not modify these structures
282 directly. Functions are provided to modify these structures.
</p>
283 <p><a class=
"reference internal" href=
"#_CPPv421memcached_server_listP12memcached_st" title=
"memcached_server_list"><code class=
"xref cpp cpp-func docutils literal notranslate"><span class=
"pre">memcached_server_list()
</span></code></a> is used to provide an array of all defined hosts. This was incorrectly documented as
"requiring free
" up till version
0.39.
</p>
284 <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 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>
285 <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
286 <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
287 <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
288 port of a memcached server.
</p>
289 <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>
290 <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 error message sent by the server to to the client.
</p>
291 <p>Before version
0.39 theses functions used a memcached_server_st *. In
0.39
292 memcached_server_st * was aliased to
<code class=
"xref cpp cpp-type docutils literal notranslate"><span class=
"pre">memcached_server_list_st
</span></code>. This was done for a style reason to help clean up some concepts in the code.
</p>
294 <div class=
"section" id=
"return-value">
295 <h2>RETURN VALUE
<a class=
"headerlink" href=
"#return-value" title=
"Permalink to this headline">¶
</a></h2>
296 <p>Varies, see particular functions.
</p>
298 <div class=
"section" id=
"see-also">
299 <h2>SEE ALSO
<a class=
"headerlink" href=
"#see-also" title=
"Permalink to this headline">¶
</a></h2>
309 <div class=
"rst-footer-buttons" role=
"navigation" aria-label=
"footer navigation">
311 <a href=
"memcached_servers.html" class=
"btn btn-neutral float-right" title=
"Manipulate the server information stored in memcached_st" accesskey=
"n" rel=
"next">Next
<span class=
"fa fa-arrow-circle-right"></span></a>
314 <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>
321 <div role=
"contentinfo">
325 © <a href=
"../copyright.html">Copyright
</a>
332 Built with
<a href=
"http://sphinx-doc.org/">Sphinx
</a> using a
334 <a href=
"https://github.com/rtfd/sphinx_rtd_theme">theme
</a>
336 provided by
<a href=
"https://readthedocs.org">Read the Docs
</a>.
348 <script type=
"text/javascript">
350 SphinxRtdTheme.Navigation.enable(true);