update docs
[m6w6/libmemcached] / libmemcached.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>C/C++ Client Library for memcached &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 src="_static/jquery.js"></script>
25 <script src="_static/underscore.js"></script>
26 <script src="_static/doctools.js"></script>
27 <script 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="libmemcached API" href="libmemcached/index.html" />
40 <link rel="prev" title="libmemcached Manual" href="index.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 current"><a class="current reference internal" href="#">Introduction</a></li>
91 <li class="toctree-l1"><a class="reference internal" href="libmemcached/index.html">libmemcached API</a></li>
92 <li class="toctree-l1"><a class="reference internal" href="libmemcached/index_misc.html">Misc</a></li>
93 </ul>
94 <p class="caption"><span class="caption-text">libmemcachedutil</span></p>
95 <ul>
96 <li class="toctree-l1"><a class="reference internal" href="libmemcachedutil.html">Introduction</a></li>
97 <li class="toctree-l1"><a class="reference internal" href="libmemcachedutil/index.html">libmemcachedutil API</a></li>
98 </ul>
99 <p class="caption"><span class="caption-text">libhashkit</span></p>
100 <ul>
101 <li class="toctree-l1"><a class="reference internal" href="libhashkit.html">Introduction</a></li>
102 <li class="toctree-l1"><a class="reference internal" href="libhashkit/index.html">libhashkit API</a></li>
103 </ul>
104 <p class="caption"><span class="caption-text">Client Applications</span></p>
105 <ul>
106 <li class="toctree-l1"><a class="reference internal" href="bin/index.html">Client Applications</a></li>
107 </ul>
108 <p class="caption"><span class="caption-text">Copyright</span></p>
109 <ul>
110 <li class="toctree-l1"><a class="reference internal" href="copyright.html">Copyright</a></li>
111 </ul>
112
113
114
115 </div>
116 </div>
117 </nav>
118
119 <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
120
121
122 <nav class="wy-nav-top" aria-label="top navigation">
123
124 <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
125 <a href="index.html">libmemcached</a>
126
127 </nav>
128
129
130 <div class="wy-nav-content">
131
132 <div class="rst-content">
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150 <div role="navigation" aria-label="breadcrumbs navigation">
151
152 <ul class="wy-breadcrumbs">
153
154 <li><a href="index.html">Docs</a> &raquo;</li>
155
156 <li>C/C++ Client Library for memcached</li>
157
158
159 <li class="wy-breadcrumbs-aside">
160
161
162
163 </li>
164
165 </ul>
166
167
168 <hr/>
169 </div>
170 <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
171 <div itemprop="articleBody">
172
173 <div class="section" id="c-c-client-library-for-memcached">
174 <h1>C/C++ Client Library for memcached<a class="headerlink" href="#c-c-client-library-for-memcached" title="Permalink to this headline"></a></h1>
175 <div class="section" id="synopsis">
176 <h2>SYNOPSIS<a class="headerlink" href="#synopsis" title="Permalink to this headline"></a></h2>
177 <dl class="simple">
178 <dt>#include &lt;libmemcached/memcached.h&gt;</dt><dd><p>Compile and link with -lmemcached</p>
179 </dd>
180 </dl>
181 <hr class="docutils" />
182 <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
183 memcached server (<a class="reference external" href="http://memcached.org/">http://memcached.org/</a>). It has been designed to be light on
184 memory usage, thread safe, and provide full access to server side methods.</p>
185 <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
186 Memcached. Some of the features provided:</p>
187 <ol class="arabic simple">
188 <li><p>Asynchronous and Synchronous Transport Support.</p></li>
189 <li><p>Consistent Hashing and Distribution.</p></li>
190 <li><p>Tunable Hashing algorithm to match keys.</p></li>
191 <li><p>Access to large object support.</p></li>
192 <li><p>Local replication.</p></li>
193 <li><p>A complete reference guide and documentation to the API.</p></li>
194 <li><p>Tools to Manage your Memcached networks.</p></li>
195 </ol>
196 </div>
197 <div class="section" id="description">
198 <h2>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
199 <p>“Memcached is a high-performance, distributed memory object caching
200 system, generic in nature, but intended for use in speeding up dynamic web
201 applications by alleviating database load.”
202 <a class="reference external" href="http://memcached.org/">http://memcached.org/</a></p>
203 <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
204 memcached protocol. The code has all been written to allow
205 for both web and embedded usage. It handles the work behind routing
206 individual keys to specific servers specified by the developer (and values are
207 matched based on server order as supplied by the user). It implements
208 a modular and consistent method of object distribution.</p>
209 <p>There are multiple implemented routing and hashing methods. See the
210 <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-func docutils literal notranslate"><span class="pre">memcached_behavior_set()</span></code></a> manpage for more information.</p>
211 <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-type docutils literal notranslate"><span class="pre">memcached_st</span></code></a> structure.
212 These structures can either be dynamically allocated or statically
213 allocated and then initialized by <a class="reference internal" href="libmemcached/memcached_create.html#_CPPv416memcached_createP12memcached_st" title="memcached_create"><code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">memcached_create()</span></code></a>. Functions have
214 been written in order to encapsulate the <a class="reference internal" href="libmemcached/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>. It is not
215 recommended that you operate directly against the structure.</p>
216 <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-type docutils literal notranslate"><span class="pre">memcached_return_t</span></code></a> value.
217 This value can be translated to a printable string with
218 <a class="reference internal" href="libmemcached/memcached_strerror.html#_CPPv418memcached_strerrorP12memcached_st18memcached_return_t" title="memcached_strerror"><code class="xref cpp cpp-type docutils literal notranslate"><span class="pre">memcached_strerror</span></code></a>.</p>
219 <p>Objects are stored on servers by hashing keys. The hash value maps the key to a
220 particular server. All clients understand how this hashing works, so it is
221 possibly to reliably both push data to a server and retrieve data from a server.</p>
222 <p>Group keys can be optionally used to group sets of objects with servers.</p>
223 <p>Namespaces are supported, and can be used to partition caches so that multiple
224 applications can use the same memcached servers.</p>
225 <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>
226 </div>
227 <div class="section" id="constants">
228 <h2>CONSTANTS<a class="headerlink" href="#constants" title="Permalink to this headline"></a></h2>
229 <p>A number of constants have been provided for in the library.</p>
230 <p>See <a class="reference internal" href="libmemcached/constants.html"><span class="doc">libmemcached Constants and Defaults</span></a>.</p>
231 </div>
232 <div class="section" id="threads-and-processes">
233 <h2>THREADS AND PROCESSES<a class="headerlink" href="#threads-and-processes" title="Permalink to this headline"></a></h2>
234 <p>No global variables are used in this library.</p>
235 <p><a class="reference internal" href="libmemcached/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> structures are thread-safe, but when using threads or
236 forked 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-type docutils literal notranslate"><span class="pre">memcached_st</span></code></a>
237 per process or thread. Without creating your own locking structures you can not
238 share a single <a class="reference internal" href="libmemcached/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>. However, you can call
239 <a class="reference internal" href="libmemcached/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> on a <a class="reference internal" href="libmemcached/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> and then use the resulting
240 cloned structure.</p>
241 </div>
242 <div class="section" id="systemtap">
243 <h2>SYSTEMTAP<a class="headerlink" href="#systemtap" title="Permalink to this headline"></a></h2>
244 <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
245 compile time.</p>
246 <p>Please see <em class="manpage"><a class="manpage reference external" href="http://man7.org/linux/man-pages/man1/stap.1.html">stap(1)</a></em> and <em class="manpage"><a class="manpage reference external" href="http://man7.org/linux/man-pages/man1/dtrace.1.html">dtrace(1)</a></em> for more information
247 about Systemtap.</p>
248 </div>
249 <div class="section" id="client-programs">
250 <h2>CLIENT PROGRAMS<a class="headerlink" href="#client-programs" title="Permalink to this headline"></a></h2>
251 <p><code class="xref cpp cpp-any docutils literal notranslate"><span class="pre">libmemcached</span></code> comes with a few useful client programs:</p>
252 <ul class="simple">
253 <li><p><a class="reference internal" href="bin/memaslap.html"><span class="doc">memaslap - Load testing and benchmarking a server</span></a></p></li>
254 <li><p><a class="reference internal" href="bin/memcapable.html"><span class="doc">memcapable - Checking a Memcached server capabilities and compatibility</span></a></p></li>
255 <li><p><a class="reference internal" href="bin/memcat.html"><span class="doc">memcat - “cat” data from a server</span></a></p></li>
256 <li><p><a class="reference internal" href="bin/memcp.html"><span class="doc">memcp - Copy data to a server</span></a></p></li>
257 <li><p><a class="reference internal" href="bin/memdump.html"><span class="doc">memdump - Dumping your server</span></a></p></li>
258 <li><p><a class="reference internal" href="bin/memerror.html"><span class="doc">memerror - translate an error code to a string</span></a></p></li>
259 <li><p><a class="reference internal" href="bin/memexist.html"><span class="doc">memexist - Check for the existence of a key</span></a></p></li>
260 <li><p><a class="reference internal" href="bin/memflush.html"><span class="doc">memflush - flush all data from a server</span></a></p></li>
261 <li><p><a class="reference internal" href="bin/memparse.html"><span class="doc">memparse - Parse an option string</span></a></p></li>
262 <li><p><a class="reference internal" href="bin/memping.html"><span class="doc">memping - Test to see if a server is available.</span></a></p></li>
263 <li><p><a class="reference internal" href="bin/memrm.html"><span class="doc">memrm - Remove data from a server</span></a></p></li>
264 <li><p><a class="reference internal" href="bin/memslap.html"><span class="doc">memslap - Load testing and benchmarking a server</span></a></p></li>
265 <li><p><a class="reference internal" href="bin/memstat.html"><span class="doc">memstat - Gather statistics from a server</span></a></p></li>
266 <li><p><a class="reference internal" href="bin/memtouch.html"><span class="doc">memtouch - Touches a key.</span></a></p></li>
267 </ul>
268 </div>
269 <div class="section" id="utility-libraries">
270 <h2>UTILITY LIBRARIES<a class="headerlink" href="#utility-libraries" title="Permalink to this headline"></a></h2>
271 <ul class="simple">
272 <li><p><a class="reference internal" href="libhashkit.html"><span class="doc">libhashkit - C/C++ hashing library</span></a></p></li>
273 <li><p><a class="reference internal" href="libmemcachedutil.html"><span class="doc">libmemcachedutil - C/C++ utilities extending libmemcached</span></a></p></li>
274 </ul>
275 </div>
276 <div class="section" id="see-also">
277 <h2>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline"></a></h2>
278 <ul class="simple">
279 <li><p><em class="manpage"><a class="manpage reference external" href="http://man7.org/linux/man-pages/man1/memcached.1.html">memcached(1)</a></em></p></li>
280 <li><p><a class="reference internal" href="libmemcached/configuration.html"><span class="doc">libmemcached Configuration</span></a></p></li>
281 <li><p><a class="reference internal" href="libmemcached/examples.html"><span class="doc">libmemcached Examples</span></a></p></li>
282 </ul>
283 </div>
284 </div>
285
286
287 </div>
288
289 </div>
290 <footer>
291
292 <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
293
294 <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>
295
296
297 <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>
298
299 </div>
300
301
302 <hr/>
303
304 <div role="contentinfo">
305 <p>
306 &copy; <a href="copyright.html">Copyright</a>
307
308 </p>
309 </div>
310 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>.
311
312 </footer>
313
314 </div>
315 </div>
316
317 </section>
318
319 </div>
320
321
322
323 <script type="text/javascript">
324 jQuery(function () {
325 SphinxRtdTheme.Navigation.enable(true);
326 });
327 </script>
328
329
330
331
332
333
334 </body>
335 </html>