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