1 ========================
2 Configuring Libmemcached
3 ========================
10 .. c:function:: memcached_st *memcached(const char *string, size_t string_length)
13 .. c:function:: memcached_return_t libmemcached_check_configuration(const char *option_string, size_t length, char *error_buffer, size_t error_buffer_size)
15 Compile and link with -lmemcached
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.
27 .. describe:: --SERVER=<servername>:<optional_port>/?<optional_weight>
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.
31 .. describe:: --VERIFY-KEY
33 Verify that keys that are being used fit within the design of the protocol being used.
35 .. describe:: --REMOVE_FAILED_SERVERS
37 Enable the behavior MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS.
39 .. describe:: --BINARY-PROTOCOL
41 Force all connections to use the binary protocol.
43 .. describe:: --BUFFER-REQUESTS
45 Enable MEMCACHED_BEHAVIOR_BUFFER_REQUESTS.
47 .. describe:: --CONFIGURE-FILE=
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.
51 .. describe:: --CONNECT-TIMEOUT=
53 Enable MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT.
55 .. describe:: --DISTRIBUTION=
57 Set the distribution model used by the client. See :manpage:`` for more details.
61 Set the hashing alogrthm used for placing keys on servers.
63 .. describe:: --HASH-WITH-NAMESPACE
65 When enabled the prefix key will be added to the key when determining which
66 server to store the data in.
68 .. describe:: --NOREPLY
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.
73 .. describe:: --NUMBER-OF-REPLICAS=
75 Set the nummber of servers that keys will be replicated to.
77 .. describe:: --RANDOMIZE-REPLICA-READ
79 Select randomly the server within the replication pool to read from.
81 .. describe:: --SORT-HOSTS
83 When adding new servers always calculate their distribution based on sorted naming order.
85 .. describe:: --SUPPORT-CAS
87 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SUPPORT_CAS
89 .. describe:: --USE-UDP
91 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_USE_UDP
93 .. describe:: --NAMESPACE=
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.
100 **********************
101 Mecached Pool Options:
102 **********************
104 .. describe:: --POOL-MIN
106 Initial size of pool.
108 .. describe:: --POOL-MAX
110 Maximize size of the pool.
116 .. describe:: --TCP-NODELAY
118 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_TCP_NODELAY
120 .. describe:: --TCP-KEEPALIVE
122 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_TCP_KEEPALIVE
124 .. describe:: --RETRY-TIMEOUT=
126 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_RETRY_TIMEOUT
128 .. describe:: --SERVER-FAILURE-LIMIT=
130 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT
132 .. describe:: --SND-TIMEOUT=
134 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SND_TIMEOUT
136 .. describe:: --SOCKET-RECV-SIZE=
138 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE
140 .. describe:: --SOCKET-SEND-SIZE=
142 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE
144 .. describe:: --POLL-TIMEOUT=
146 That sets the value of the timeout used by :manpage: `poll()`.
148 .. describe:: --IO-BYTES-WATERMARK=
150 .. describe:: --IO-KEY-PREFETCH=
152 .. describe:: --IO-MSG-WATERMARK=
154 .. describe:: --TCP-KEEPIDLE
156 .. describe:: --RCV-TIMEOUT=
165 .. describe:: INCLUDE
167 Include a file in configuration. Unlike --CONFIGURE-FILE= this will not reset memcached_st
171 Reset memcached_st and continue to process.
175 End configutation processing.
179 End configutation processing and throw an error.
187 memcached() returns a pointer to the memcached_st that was
188 created (or initialized). On an allocation failure, it returns NULL.
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);
204 memcached_free(memc);
213 To find out more information please check:
214 `http://libmemcached.org/ <http://libmemcached.org/>`_
223 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`