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