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