1 ========================
2 Configuring Libmemcached
3 ========================
11 #include <libmemcached-1.0/memcached.h>
13 .. envvar:: LIBMEMCACHED
15 .. c:function:: memcached_st *memcached(const char *string, size_t string_length)
17 .. c:function:: memcached_return_t libmemcached_check_configuration(const char *option_string, size_t length, char *error_buffer, size_t error_buffer_size)
19 Compile and link with -lmemcached
26 Libmemcached implements a custom language for configuring and modifying
27 servers. By passing in an option string you can generate a ``memcached_st`` object
28 that you can use in your application directly.
30 .. describe:: --SERVER=<servername>:<optional_port>/?<optional_weight>
32 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.
34 .. describe:: --SOCKET=\"<filepath>/?<optional_weight>\"
36 Provide a filepath to a UNIX socket file. Providing a weight will cause weighting to occur with all hosts with each server getting a default weight of 1.
38 .. describe:: --VERIFY-KEY
40 Verify that keys that are being used fit within the design of the protocol being used.
42 .. describe:: --REMOVE_FAILED_SERVERS
44 Enable the behavior MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS.
46 .. describe:: --BINARY-PROTOCOL
48 Force all connections to use the binary protocol.
50 .. describe:: --BUFFER-REQUESTS
52 Enable MEMCACHED_BEHAVIOR_BUFFER_REQUESTS.
54 .. describe:: --CONFIGURE-FILE=
56 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.
58 .. describe:: --CONNECT-TIMEOUT=
60 Enable MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT.
62 .. describe:: --DISTRIBUTION=
64 Set the distribution model used by the client. See :manpage:`` for more details.
68 Set the hashing alogrthm used for placing keys on servers.
70 .. describe:: --HASH-WITH-NAMESPACE
72 When enabled the prefix key will be added to the key when determining which
73 server to store the data in.
75 .. describe:: --NOREPLY
77 Enable "no reply" for all calls that support this. It is highly recommended
78 that you use this option with the binary protocol only.
80 .. describe:: --NUMBER-OF-REPLICAS=
82 Set the nummber of servers that keys will be replicated to.
84 .. describe:: --RANDOMIZE-REPLICA-READ
86 Select randomly the server within the replication pool to read from.
88 .. describe:: --SORT-HOSTS
90 When adding new servers always calculate their distribution based on sorted naming order.
92 .. describe:: --SUPPORT-CAS
94 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SUPPORT_CAS
96 .. describe:: --USE-UDP
98 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_USE_UDP
100 .. describe:: --NAMESPACE=
102 A namespace is a container that provides context for keys, only other
103 requests that know the namespace can access these values. This is
104 accomplished by prepending the namespace value to all keys.
107 **********************
108 Mecached Pool Options:
109 **********************
111 .. describe:: --POOL-MIN
113 Initial size of pool.
115 .. describe:: --POOL-MAX
117 Maximize size of the pool.
123 .. describe:: --TCP-NODELAY
125 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_TCP_NODELAY
127 .. describe:: --TCP-KEEPALIVE
129 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_TCP_KEEPALIVE
131 .. describe:: --RETRY-TIMEOUT=
133 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_RETRY_TIMEOUT
135 .. describe:: --SERVER-FAILURE-LIMIT=
137 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT
139 .. describe:: --SND-TIMEOUT=
141 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SND_TIMEOUT
143 .. describe:: --SOCKET-RECV-SIZE=
145 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE
147 .. describe:: --SOCKET-SEND-SIZE=
149 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE
151 .. describe:: --POLL-TIMEOUT=
153 That sets the value of the timeout used by :manpage: `poll()`.
155 .. describe:: --IO-BYTES-WATERMARK=
157 .. describe:: --IO-KEY-PREFETCH=
159 .. describe:: --IO-MSG-WATERMARK=
161 .. describe:: --TCP-KEEPIDLE
163 .. describe:: --RCV-TIMEOUT=
172 .. describe:: INCLUDE
174 Include a file in configuration. Unlike --CONFIGURE-FILE= this will not reset memcached_st
178 Reset memcached_st and continue to process.
182 End configutation processing.
186 End configutation processing and throw an error.
194 :c:func:`memcached()` returns a pointer to the memcached_st that was
195 created (or initialized). On an allocation failure, it returns NULL.
206 const char *config_string= "--SERVER=host10.example.com --SERVER=host11.example.com --SERVER=host10.example.com"
207 memcached_st *memc= memcached(config_string, strlen(config_string);
211 memcached_free(memc);
220 To find out more information please check:
221 `http://libmemcached.org/ <http://libmemcached.org/>`_
230 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`