1 ========================
2 Configuring Libmemcached
3 ========================
10 .. c:function:: memcached_st *memcached_create_with_options(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.
104 .. describe:: --TCP-NODELAY
106 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_TCP_NODELAY
108 .. describe:: --TCP-KEEPALIVE
110 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_TCP_KEEPALIVE
112 .. describe:: --RETRY-TIMEOUT=
114 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_RETRY_TIMEOUT
116 .. describe:: --SERVER-FAILURE-LIMIT=
118 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT
120 .. describe:: --SND-TIMEOUT=
122 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SND_TIMEOUT
124 .. describe:: --SOCKET-RECV-SIZE=
126 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE
128 .. describe:: --SOCKET-SEND-SIZE=
130 See :manpage:`memcached_behavior_set(3)` for MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE
132 .. describe:: --POLL-TIMEOUT=
134 That sets the value of the timeout used by :manpage: `poll()`.
136 .. describe:: --IO-BYTES-WATERMARK=
138 .. describe:: --IO-KEY-PREFETCH=
140 .. describe:: --IO-MSG-WATERMARK=
142 .. describe:: --TCP-KEEPIDLE
144 .. describe:: --RCV-TIMEOUT=
153 .. describe:: INCLUDE
155 Include a file in configuration. Unlike --CONFIGURE-FILE= this will not reset memcached_st
159 Reset memcached_st and continue to process.
163 End configutation processing.
167 End configutation processing and throw an error.
175 memcached_create_with_options() returns a pointer to the memcached_st that was
176 created (or initialized). On an allocation failure, it returns NULL.
187 const char *config_string= "--SERVER=host10.example.com --SERVER=host11.example.com --SERVER=host10.example.com"
188 memcached_st *memc= memcached_create_with_options(config_string, strlen(config_string);
192 memcached_free(memc);
201 To find out more information please check:
202 `https://launchpad.net/libmemcached <https://launchpad.net/libmemcached>`_
211 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`