1LIBMEMCACHED(3) libmemcached LIBMEMCACHED(3)
2
3
4
6 libmemcached - Introducing the C Client Library for memcached
7
9 #include <libmemcached/memcached.h>
10
11 Compile and link with -lmemcached
12
13
14 ----
15
16
17
18 libMemcached is an open source C/C++ client library and tools for the
19 memcached server (http://memcached.org/). It has been designed to be
20 light on memory usage, thread safe, and provide full access to server
21 side methods.
22
23 libMemcached was designed to provide the greatest number of options to
24 use Memcached. Some of the features provided:
25
26 1. Asynchronous and Synchronous Transport Support.
27
28 2. Consistent Hashing and Distribution.
29
30 3. Tunable Hashing algorithm to match keys.
31
32 4. Access to large object support.
33
34 5. Local replication.
35
36 6. A complete reference guide and documentation to the API.
37
38 7. Tools to Manage your Memcached networks.
39
41 "Memcached is a high-performance, distributed memory object caching
42 system, generic in nature, but intended for use in speeding up dynamic
43 web applications by alleviating database load." http://memcached.org/
44
45 libmemcached is a small, thread-safe client library for the memcached
46 protocol. The code has all been written to allow for both web and
47 embedded usage. It handles the work behind routing individual keys to
48 specific servers specified by the developer (and values are matched
49 based on server order as supplied by the user). It implements a modular
50 and consistent method of object distribution.
51
52 There are multiple implemented routing and hashing methods. See the
53 memcached_behavior_set() manpage for more information.
54
55 All operations are performed against a memcached_st structure. These
56 structures can either be dynamically allocated or statically allocated
57 and then initialized by memcached_create(). Functions have been written
58 in order to encapsulate the memcached_st. It is not recommended that
59 you operate directly against the structure.
60
61 Nearly all functions return a memcached_return_t value. This value can
62 be translated to a printable string with memcached_strerror.
63
64 Objects are stored on servers by hashing keys. The hash value maps the
65 key to a particular server. All clients understand how this hashing
66 works, so it is possibly to reliably both push data to a server and
67 retrieve data from a server.
68
69 Group keys can be optionally used to group sets of objects with
70 servers.
71
72 Namespaces are supported, and can be used to partition caches so that
73 multiple applications can use the same memcached servers.
74
75 memcached_st structures are thread-safe, but each thread must contain
76 its own structure (that is, if you want to share these among threads
77 you must provide your own locking). No global variables are used in
78 this library.
79
80 If you are working with GNU autotools you will want to add the follow‐
81 ing to your COPYING to properly include libmemcached in your applica‐
82 tion.
83
84 PKG_CHECK_MODULES(DEPS, libmemcached >= 0.8.0) AC_SUBST(DEPS_CFLAGS)
85 AC_SUBST(DEPS_LIBS)
86
87 Some features of the library must be enabled through memcached_behav‐
88 ior_set().
89
90 Hope you enjoy it!
91
93 A number of constants have been provided for in the library.
94
95 MEMCACHED_DEFAULT_PORT
96 The default port used by memcached(3).
97
98 MEMCACHED_MAX_KEY
99 Default maximum size of a key (which includes the null pointer).
100 Master keys have no limit, this only applies to keys used for
101 storage.
102
103 MEMCACHED_MAX_KEY
104 Default size of key (which includes the null pointer).
105
106 MEMCACHED_STRIDE
107 This is the "stride" used in the consistent hash used between
108 replicas.
109
110 MEMCACHED_MAX_HOST_LENGTH
111 Maximum allowed size of the hostname.
112
113 LIBMEMCACHED_VERSION_STRING
114 String value of libmemcached version such as "1.23.4"
115
116 LIBMEMCACHED_VERSION_HEX
117 Hex value of the version number. "0x00048000" This can be used
118 for comparing versions based on number.
119
120 MEMCACHED_PREFIX_KEY_MAX_SIZE
121 Maximum length allowed for namespacing of a key.
122
124 When using threads or forked processes it is important to keep one
125 instance of memcached_st per process or thread. Without creating your
126 own locking structures you can not share a single memcached_st. How‐
127 ever, you can call memcached_quit() on a memcached_st and then use the
128 resulting cloned structure.
129
131 To find out more information please check: http://libmemcached.org/
132
134 memcached(1) libmemcached_examples(3) libmemcached(1) memcat(1)
135 memcp(1) memflush(1) memrm(1) memslap(1) memstat(1) memcached_fetch(3)
136 memcached_replace(3) memcached_server_list_free(3) libmemcached_exam‐
137 ples(3) memcached_clone(3) memcached_free(3) memcached_server_add(3)
138 memcached_server_push(3) memcached_add(3) memcached_get(3) mem‐
139 cached_server_count(3) memcached_create(3) memcached_increment(3) mem‐
140 cached_server_list(3) memcached_set(3) memcached_decrement(3) mem‐
141 cached_mget(3) memcached_server_list_append(3) memcached_strerror(3)
142 memcached_delete(3) memcached_quit(3) memcached_server_list_count(3)
143 memcached_verbosity(3) memcached_server_add_unix_socket(3) mem‐
144 cached_result_create(3) memcached_result_free(3) mem‐
145 cached_result_key_value(3) memcached_result_key_length(3) mem‐
146 cached_result_value(3) memcached_result_length(3) mem‐
147 cached_result_flags(3) memcached_result_cas(3) memcached_result_st(3)
148 memcached_append(3) memcached_prepend(3) memcached_fetch_result(3)
149 memerror(1) memcached_get_by_key(3) memcached_mget_by_key(3) mem‐
150 cached_delete_by_key(3) memcached_fetch_execute(3) memcached_call‐
151 back_get(3) memcached_callback_set(3) memcached_version(3) mem‐
152 cached_lib_version(3) memcached_result_set_value(3) memcached_dump(3)
153 memdump(1) memcached_set_memory_allocators(3) memcached_get_mem‐
154 ory_allocators(3) memcached_get_user_data(3) memcached_set_user_data(3)
155
157 Brian Aker
158
160 2011-2013, Brian Aker DataDifferential, http://datadifferential.com/
161
162
163
164
1651.0.16 January 31, 2013 LIBMEMCACHED(3)