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