update docs
[m6w6/libmemcached] / libmemcached.html
1
2
3 <!DOCTYPE html>
4 <html class="writer-html5" lang="en" >
5 <head>
6 <meta charset="utf-8">
7
8 <meta name="viewport" content="width=device-width, initial-scale=1.0">
9
10 <title>C/C++ Client Library for memcached &mdash; libmemcached 1.0.99 documentation</title>
11
12
13
14 <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
15 <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
16
17
18
19
20
21
22
23 <!--[if lt IE 9]>
24 <script src="_static/js/html5shiv.min.js"></script>
25 <![endif]-->
26
27
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>
33
34 <script type="text/javascript" src="_static/js/theme.js"></script>
35
36
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="libmemcached API" href="libmemcached/index.html" />
41 <link rel="prev" title="libmemcached Manual" href="index.html" />
42 </head>
43
44 <body class="wy-body-for-nav">
45
46
47 <div class="wy-grid-for-nav">
48
49 <nav data-toggle="wy-nav-shift" class="wy-nav-side">
50 <div class="wy-side-scroll">
51 <div class="wy-side-nav-search" >
52
53
54
55 <a href="index.html" class="icon icon-home" alt="Documentation Home"> libmemcached
56
57
58
59 </a>
60
61
62
63
64 <div class="version">
65 1.0
66 </div>
67
68
69
70
71 <div role="search">
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" />
76 </form>
77 </div>
78
79
80 </div>
81
82
83 <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
84
85
86
87
88
89
90 <p class="caption"><span class="caption-text">libmemcached</span></p>
91 <ul class="current">
92 <li class="toctree-l1 current"><a class="current reference internal" href="#">Introduction</a></li>
93 <li class="toctree-l1"><a class="reference internal" href="libmemcached/index.html">libmemcached API</a></li>
94 <li class="toctree-l1"><a class="reference internal" href="libmemcached/index_misc.html">Misc</a></li>
95 </ul>
96 <p class="caption"><span class="caption-text">libmemcachedutil</span></p>
97 <ul>
98 <li class="toctree-l1"><a class="reference internal" href="libmemcachedutil.html">Introduction</a></li>
99 <li class="toctree-l1"><a class="reference internal" href="libmemcachedutil/index.html">libmemcachedutil API</a></li>
100 </ul>
101 <p class="caption"><span class="caption-text">libhashkit</span></p>
102 <ul>
103 <li class="toctree-l1"><a class="reference internal" href="libhashkit.html">Introduction</a></li>
104 <li class="toctree-l1"><a class="reference internal" href="libhashkit/index.html">libhashkit API</a></li>
105 </ul>
106 <p class="caption"><span class="caption-text">Client Applications</span></p>
107 <ul>
108 <li class="toctree-l1"><a class="reference internal" href="bin/index.html">Client Applications</a></li>
109 </ul>
110 <p class="caption"><span class="caption-text">Copyright</span></p>
111 <ul>
112 <li class="toctree-l1"><a class="reference internal" href="copyright.html">Copyright</a></li>
113 </ul>
114
115
116
117 </div>
118
119 </div>
120 </nav>
121
122 <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
123
124
125 <nav class="wy-nav-top" aria-label="top navigation">
126
127 <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
128 <a href="index.html">libmemcached</a>
129
130 </nav>
131
132
133 <div class="wy-nav-content">
134
135 <div class="rst-content">
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153 <div role="navigation" aria-label="breadcrumbs navigation">
154
155 <ul class="wy-breadcrumbs">
156
157 <li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
158
159 <li>C/C++ Client Library for memcached</li>
160
161
162 <li class="wy-breadcrumbs-aside">
163
164
165
166 </li>
167
168 </ul>
169
170
171 <hr/>
172 </div>
173 <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
174 <div itemprop="articleBody">
175
176 <div class="section" id="c-c-client-library-for-memcached">
177 <h1>C/C++ Client Library for memcached<a class="headerlink" href="#c-c-client-library-for-memcached" title="Permalink to this headline"></a></h1>
178 <div class="section" id="synopsis">
179 <h2>SYNOPSIS<a class="headerlink" href="#synopsis" title="Permalink to this headline"></a></h2>
180 <dl class="simple">
181 <dt>#include &lt;libmemcached/memcached.h&gt;</dt><dd><p>Compile and link with -lmemcached</p>
182 </dd>
183 </dl>
184 <hr class="docutils" />
185 <p><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">libmemcached</span></code> is an open source C/C++ client library and tools for the
186 memcached server (<a class="reference external" href="http://memcached.org/">http://memcached.org/</a>). It has been designed to be light on
187 memory usage, thread safe, and provide full access to server side methods.</p>
188 <p><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">libmemcached</span></code> was designed to provide the greatest number of options to use
189 Memcached. Some of the features provided:</p>
190 <ol class="arabic simple">
191 <li><p>Asynchronous and Synchronous Transport Support.</p></li>
192 <li><p>Consistent Hashing and Distribution.</p></li>
193 <li><p>Tunable Hashing algorithm to match keys.</p></li>
194 <li><p>Access to large object support.</p></li>
195 <li><p>Local replication.</p></li>
196 <li><p>A complete reference guide and documentation to the API.</p></li>
197 <li><p>Tools to Manage your Memcached networks.</p></li>
198 </ol>
199 </div>
200 <div class="section" id="description">
201 <h2>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
202 <p>&quot;Memcached is a high-performance, distributed memory object caching system,
203 generic in nature, but intended for use in speeding up dynamic web applications
204 by alleviating database load.&quot; <a class="reference external" href="http://memcached.org/">http://memcached.org/</a></p>
205 <p><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">libmemcached</span></code> is a small, thread-safe client library for the memcached
206 protocol. The code has all been written to allow for both web and embedded
207 usage. It handles the work behind routing individual keys to specific servers
208 specified by the developer (and values are matched based on server order as
209 supplied by the user). It implements a modular and consistent method of object
210 distribution.</p>
211 <p>There are multiple implemented routing and hashing methods. See the
212 <a class="reference internal" href="libmemcached/memcached_behavior.html#_CPPv422memcached_behavior_setP12memcached_st20memcached_behavior_t8uint64_t" title="memcached_behavior_set"><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">memcached_behavior_set()</span></code></a> manpage for more information.</p>
213 <p>All operations are performed against a <a class="reference internal" href="libmemcached/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> structure. These
214 structures can either be dynamically allocated or statically allocated and then
215 initialized by <a class="reference internal" href="libmemcached/memcached_create.html#_CPPv416memcached_createP12memcached_st" title="memcached_create"><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">memcached_create()</span></code></a>. Functions have been written in order to
216 encapsulate the <a class="reference internal" href="libmemcached/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>. It is not recommended that you operate directly
217 against the structure.</p>
218 <p>Nearly all functions return a <a class="reference internal" href="libmemcached/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> value. This value can be
219 translated to a printable string with <a class="reference internal" href="libmemcached/memcached_strerror.html#_CPPv418memcached_strerrorP12memcached_st18memcached_return_t" title="memcached_strerror"><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">memcached_strerror()</span></code></a>.</p>
220 <p>Objects are stored on servers by hashing keys. The hash value maps the key to a
221 particular server. All clients understand how this hashing works, so it is
222 possibly to reliably both push data to a server and retrieve data from a server.</p>
223 <p>Group keys can be optionally used to group sets of objects with servers.</p>
224 <p>Namespaces are supported, and can be used to partition caches so that multiple
225 applications can use the same memcached servers.</p>
226 <p>Some features of the library must be enabled through <a class="reference internal" href="libmemcached/memcached_behavior.html#_CPPv422memcached_behavior_setP12memcached_st20memcached_behavior_t8uint64_t" title="memcached_behavior_set"><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">memcached_behavior_set()</span></code></a>.</p>
227 </div>
228 <div class="section" id="threads-and-processes">
229 <h2>THREADS AND PROCESSES<a class="headerlink" href="#threads-and-processes" title="Permalink to this headline"></a></h2>
230 <p>No global variables are used in this library.</p>
231 <p><a class="reference internal" href="libmemcached/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> structures are thread-safe, but when using threads or forked
232 processes it is important to keep one instance of <a class="reference internal" href="libmemcached/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> per process or
233 thread. Without creating your own locking structures you can not share a single
234 <a class="reference internal" href="libmemcached/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>. However, you can call <a class="reference internal" href="libmemcached/memcached_quit.html#_CPPv414memcached_quitP12memcached_st" title="memcached_quit"><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">memcached_quit()</span></code></a> on a <a class="reference internal" href="libmemcached/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> and
235 then use the resulting cloned structure.</p>
236 </div>
237 <div class="section" id="systemtap">
238 <h2>SYSTEMTAP<a class="headerlink" href="#systemtap" title="Permalink to this headline"></a></h2>
239 <p><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">libmemcached</span></code> can be built to support Systemtap on Linux when enabled at
240 compile time.</p>
241 <p>Please see <em class="manpage"><a class="manpage reference external" href="https://linux.die.net/man/1/stap">stap(1)</a></em> and <em class="manpage"><a class="manpage reference external" href="https://linux.die.net/man/1/dtrace">dtrace(1)</a></em> for more information
242 about Systemtap.</p>
243 </div>
244 <div class="section" id="client-programs">
245 <h2>CLIENT PROGRAMS<a class="headerlink" href="#client-programs" title="Permalink to this headline"></a></h2>
246 <p><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">libmemcached</span></code> comes with a few useful client programs:</p>
247 <ul class="simple">
248 <li><p><a class="reference internal" href="bin/memaslap.html"><span class="doc">memaslap - Load testing and benchmarking a server</span></a></p></li>
249 <li><p><a class="reference internal" href="bin/memcapable.html"><span class="doc">memcapable</span></a></p></li>
250 <li><p><a class="reference internal" href="bin/memcat.html"><span class="doc">memcat</span></a></p></li>
251 <li><p><a class="reference internal" href="bin/memcp.html"><span class="doc">memcp</span></a></p></li>
252 <li><p><a class="reference internal" href="bin/memdump.html"><span class="doc">memdump</span></a></p></li>
253 <li><p><a class="reference internal" href="bin/memerror.html"><span class="doc">memerror</span></a></p></li>
254 <li><p><a class="reference internal" href="bin/memexist.html"><span class="doc">memexist</span></a></p></li>
255 <li><p><a class="reference internal" href="bin/memflush.html"><span class="doc">memflush</span></a></p></li>
256 <li><p><a class="reference internal" href="bin/memparse.html"><span class="doc">memparse</span></a></p></li>
257 <li><p><a class="reference internal" href="bin/memping.html"><span class="doc">memping</span></a></p></li>
258 <li><p><a class="reference internal" href="bin/memrm.html"><span class="doc">memrm</span></a></p></li>
259 <li><p><a class="reference internal" href="bin/memslap.html"><span class="doc">memslap</span></a></p></li>
260 <li><p><a class="reference internal" href="bin/memstat.html"><span class="doc">memstat</span></a></p></li>
261 <li><p><a class="reference internal" href="bin/memtouch.html"><span class="doc">memtouch</span></a></p></li>
262 </ul>
263 </div>
264 <div class="section" id="utility-libraries">
265 <h2>UTILITY LIBRARIES<a class="headerlink" href="#utility-libraries" title="Permalink to this headline"></a></h2>
266 <ul class="simple">
267 <li><p><a class="reference internal" href="libhashkit.html"><span class="doc">libhashkit - C/C++ hashing library</span></a></p></li>
268 <li><p><a class="reference internal" href="libmemcachedutil.html"><span class="doc">libmemcachedutil - C/C++ utilities extending libmemcached</span></a></p></li>
269 </ul>
270 </div>
271 <div class="section" id="see-also">
272 <h2>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline"></a></h2>
273 <ul class="simple">
274 <li><p><em class="manpage"><a class="manpage reference external" href="https://linux.die.net/man/1/memcached">memcached(1)</a></em></p></li>
275 <li><p><a class="reference internal" href="libmemcached/configuration.html"><span class="doc">libmemcached Configuration</span></a></p></li>
276 <li><p><a class="reference internal" href="libmemcached/examples.html"><span class="doc">libmemcached Examples</span></a></p></li>
277 </ul>
278 </div>
279 </div>
280
281
282 </div>
283
284 </div>
285 <footer>
286
287 <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
288
289 <a href="libmemcached/index.html" class="btn btn-neutral float-right" title="libmemcached API" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
290
291
292 <a href="index.html" class="btn btn-neutral float-left" title="libmemcached Manual" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
293
294 </div>
295
296
297 <hr/>
298
299 <div role="contentinfo">
300 <p>
301
302
303 &copy; <a href="copyright.html">Copyright</a>
304
305 </p>
306 </div>
307
308
309
310 Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a
311
312 <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a>
313
314 provided by <a href="https://readthedocs.org">Read the Docs</a>.
315
316 </footer>
317
318 </div>
319 </div>
320
321 </section>
322
323 </div>
324
325
326 <script type="text/javascript">
327 jQuery(function () {
328 SphinxRtdTheme.Navigation.enable(true);
329 });
330 </script>
331
332
333
334
335
336
337 </body>
338 </html>