Merge in trunk. Updates to manual/update to latest libtest.
[awesomized/libmemcached] / docs / libmemcached_configuration.rst
1 ========================
2 Configuring Libmemcached
3 ========================
4
5 .. highlightlang:: c
6
7 --------
8 SYNOPSIS
9 --------
10
11 #include <libmemcached/memcached.h>
12
13 .. c:function:: memcached_st *memcached(const char *string, size_t string_length)
14
15 .. c:function:: memcached_return_t libmemcached_check_configuration(const char *option_string, size_t length, char *error_buffer, size_t error_buffer_size)
16
17 Compile and link with -lmemcached
18
19
20 -----------
21 DESCRIPTION
22 -----------
23
24 Libmemcached implements a custom language for configuring and modifying
25 servers. By passing in an option string you can generate a ``memcached_st`` object
26 that you can use in your application directly.
27
28 .. describe:: --SERVER=<servername>:<optional_port>/?<optional_weight>
29
30 Provide a servername to be used by the client. Providing a weight will cause weighting to occur with all hosts with each server getting a default weight of 1.
31
32 .. describe:: --VERIFY-KEY
33
34 Verify that keys that are being used fit within the design of the protocol being used.
35
36 .. describe:: --REMOVE_FAILED_SERVERS
37
38 Enable the behavior MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS.
39
40 .. describe:: --BINARY-PROTOCOL
41
42 Force all connections to use the binary protocol.
43
44 .. describe:: --BUFFER-REQUESTS
45
46 Enable MEMCACHED_BEHAVIOR_BUFFER_REQUESTS.
47
48 .. describe:: --CONFIGURE-FILE=
49
50 Provide a configuration file to be used to load requests. Beware that by using a configuration file libmemcached will reset memcached_st based on information only contained in the file.
51
52 .. describe:: --CONNECT-TIMEOUT=
53
54 Enable MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT.
55
56 .. describe:: --DISTRIBUTION=
57
58 Set the distribution model used by the client. See :manpage:`` for more details.
59
60 .. describe:: --HASH=
61
62 Set the hashing alogrthm used for placing keys on servers.
63
64 .. describe:: --HASH-WITH-NAMESPACE
65
66 When enabled the prefix key will be added to the key when determining which
67 server to store the data in.
68
69 .. describe:: --NOREPLY
70
71 Enable "no reply" for all calls that support this. It is highly recommended
72 that you use this option with the binary protocol only.
73
74 .. describe:: --NUMBER-OF-REPLICAS=
75
76 Set the nummber of servers that keys will be replicated to.
77
78 .. describe:: --RANDOMIZE-REPLICA-READ
79
80 Select randomly the server within the replication pool to read from.
81
82 .. describe:: --SORT-HOSTS
83
84 When adding new servers always calculate their distribution based on sorted naming order.
85
86 .. describe:: --SUPPORT-CAS
87
88 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SUPPORT_CAS
89
90 .. describe:: --USE-UDP
91
92 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_USE_UDP
93
94 .. describe:: --NAMESPACE=
95
96 A namespace is a container that provides context for keys, only other
97 requests that know the namespace can access these values. This is
98 accomplished by prepending the namespace value to all keys.
99
100
101 **********************
102 Mecached Pool Options:
103 **********************
104
105 .. describe:: --POOL-MIN
106
107 Initial size of pool.
108
109 .. describe:: --POOL-MAX
110
111 Maximize size of the pool.
112
113 ************
114 I/O Options:
115 ************
116
117 .. describe:: --TCP-NODELAY
118
119 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_TCP_NODELAY
120
121 .. describe:: --TCP-KEEPALIVE
122
123 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_TCP_KEEPALIVE
124
125 .. describe:: --RETRY-TIMEOUT=
126
127 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_RETRY_TIMEOUT
128
129 .. describe:: --SERVER-FAILURE-LIMIT=
130
131 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT
132
133 .. describe:: --SND-TIMEOUT=
134
135 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SND_TIMEOUT
136
137 .. describe:: --SOCKET-RECV-SIZE=
138
139 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE
140
141 .. describe:: --SOCKET-SEND-SIZE=
142
143 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE
144
145 .. describe:: --POLL-TIMEOUT=
146
147 That sets the value of the timeout used by :manpage: `poll()`.
148
149 .. describe:: --IO-BYTES-WATERMARK=
150
151 .. describe:: --IO-KEY-PREFETCH=
152
153 .. describe:: --IO-MSG-WATERMARK=
154
155 .. describe:: --TCP-KEEPIDLE
156
157 .. describe:: --RCV-TIMEOUT=
158
159
160
161 ******
162 Other:
163 ******
164
165
166 .. describe:: INCLUDE
167
168 Include a file in configuration. Unlike --CONFIGURE-FILE= this will not reset memcached_st
169
170 .. describe:: RESET
171
172 Reset memcached_st and continue to process.
173
174 .. describe:: END
175
176 End configutation processing.
177
178 .. describe:: ERROR
179
180 End configutation processing and throw an error.
181
182
183 ------
184 RETURN
185 ------
186
187
188 memcached() returns a pointer to the memcached_st that was
189 created (or initialized). On an allocation failure, it returns NULL.
190
191
192
193 -------
194 EXAMPLE
195 -------
196
197
198 .. code-block:: c
199
200 const char *config_string= "--SERVER=host10.example.com --SERVER=host11.example.com --SERVER=host10.example.com"
201 memcached_st *memc= memcached(config_string, strlen(config_string);
202 {
203 ...
204 }
205 memcached_free(memc);
206
207
208
209 ----
210 HOME
211 ----
212
213
214 To find out more information please check:
215 `http://libmemcached.org/ <http://libmemcached.org/>`_
216
217
218
219 --------
220 SEE ALSO
221 --------
222
223
224 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`