1memcached_behavior_get.pop(3)memcached_behavior_getmemcached_behavior_get.pop(3)
2
3
4

NAME

6       memcached_behavior_get, memcached_behavior_set - Manipulate behavior
7

LIBRARY

9       C Client Library for memcached (libmemcached, -lmemcached)
10

SYNOPSIS

12         #include <memcached.h>
13
14         uint64_t
15           memcached_behavior_get (memcached_st *ptr,
16                                   memcached_behavior flag);
17
18         memcached_return_t
19           memcached_behavior_set (memcached_st *ptr,
20                                   memcached_behavior flag,
21                                   uint64_t data);
22

DESCRIPTION

24       libmemcached(3) behavior can be modified by use
25       memcached_behavior_set().  Default behavior is the library strives to
26       be quick and accurate. Some behavior, while being faster, can also
27       result in not entirely accurate behavior (for instance, memcached_set()
28       will always respond with "MEMCACHED_SUCCESS").
29
30       memcached_behavior_get() takes a behavior flag and returns whether or
31       not that behavior is currently enabled in the client.
32
33       memcached_behavior_set() changes the value of a particular option of
34       the client. It takes both a flag (listed below) and a value. For simple
35       on or off options you just need to pass in a value of 1. Calls to
36       memcached_behavior_set() will flush and reset all connections.
37
38       MEMCACHED_BEHAVIOR_USE_UDP
39           Causes libmemcached(3) to use the UDP transport when communicating
40           with a memcached server. Not all I/O operations are supported when
41           this behavior is enababled. The following operations will return
42           "MEMCACHED_NOT_SUPPORTED" when executed with the
43           MEMCACHED_BEHAVIOR_USE_UDP enabled: memcached_version(),
44           memcached_stat(), memcached_get(), memcached_get_by_key(),
45           memcached_mget(), memcached_mget_by_key(), memcached_fetch(),
46           memcached_fetch_result(), memcached_value_fetch().
47
48           All other operations are supported but are executed in a
49           'fire-and-forget' mode, in which once the client has executed the
50           operation, no attempt will be made to ensure the operation has been
51           received and acted on by the server.
52
53           libmemcached(3) does not allow TCP and UDP servers to be shared
54           within the same libmemached(3) client 'instance'. An attempt to add
55           a TCP server when this behavior is enabled will result in a
56           "MEMCACHED_INVALID_HOST_PROTOCOL", as will attempting to add a UDP
57           server when this behavior has not been enabled.
58
59       MEMCACHED_BEHAVIOR_NO_BLOCK
60           Causes libmemcached(3) to use asychronous IO. This is the fastest
61           transport available for storage functions.
62
63       MEMCACHED_BEHAVIOR_SND_TIMEOUT
64           This sets the microsecond behavior of the socket against the
65           SO_SNDTIMEO flag.  In cases where you cannot use non-blocking IO
66           this will allow you to still have timeouts on the sending of data.
67
68       MEMCACHED_BEHAVIOR_RCV_TIMEOUT
69           This sets the microsecond behavior of the socket against the
70           SO_RCVTIMEO flag.  In cases where you cannot use non-blocking IO
71           this will allow you to still have timeouts on the reading of data.
72
73       MEMCACHED_BEHAVIOR_TCP_NODELAY
74           Turns on the no-delay feature for connecting sockets (may be faster
75           in some environments).
76
77       MEMCACHED_BEHAVIOR_HASH
78           Makes the default hashing algorithm for keys use MD5. The value can
79           be set to either MEMCACHED_HASH_DEFAULT, MEMCACHED_HASH_MD5,
80           MEMCACHED_HASH_CRC, MEMCACHED_HASH_FNV1_64,
81           MEMCACHED_HASH_FNV1A_64, MEMCACHED_HASH_FNV1_32,
82           MEMCACHED_HASH_FNV1A_32, MEMCACHED_HASH_JENKINS,
83           MEMCACHED_HASH_HSIEH, and MEMCACHED_HASH_MURMUR.  Each hash has
84           it's advantages and it's weaknesses. If you don't know or don't
85           care, just go with the default.  Support for MEMCACHED_HASH_HSIEH
86           is a compile time option that is disabled by default. To enable
87           support for this hashing algorithm, configure and build
88           libmemcached with the --enable-hash_hsieh.
89
90       MEMCACHED_BEHAVIOR_DISTRIBUTION
91           Using this you can enable different means of distributing values to
92           servers.  The default method is MEMCACHED_DISTRIBUTION_MODULA. You
93           can enable consistent hashing by setting
94           MEMCACHED_DISTRIBUTION_CONSISTENT.  Consistent hashing delivers
95           better distribution and allows servers to be added to the cluster
96           with minimal cache losses. Currently
97           MEMCACHED_DISTRIBUTION_CONSISTENT is an alias for the value
98           MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA.
99
100       MEMCACHED_BEHAVIOR_CACHE_LOOKUPS
101           Memcached can cache named lookups so that DNS lookups are made only
102           once.
103
104       MEMCACHED_BEHAVIOR_SUPPORT_CAS
105           Support CAS operations (this is not enabled by default at this
106           point in the server since it imposes a slight performance penalty).
107
108       MEMCACHED_BEHAVIOR_KETAMA
109           Sets the default distribution to
110           MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA and the hash to
111           MEMCACHED_HASH_MD5.
112
113       MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED
114           Sets the default distribution to
115           MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA with the weighted support.
116           and the hash to MEMCACHED_HASH_MD5.
117
118       MEMCACHED_BEHAVIOR_KETAMA_HASH
119           Sets the hashing algorithm for host mapping on continuum. The value
120           can be set to either MEMCACHED_HASH_DEFAULT, MEMCACHED_HASH_MD5,
121           MEMCACHED_HASH_CRC, MEMCACHED_HASH_FNV1_64,
122           MEMCACHED_HASH_FNV1A_64, MEMCACHED_HASH_FNV1_32, and
123           MEMCACHED_HASH_FNV1A_32.
124
125       MEMCACHED_BEHAVIOR_KETAMA_COMPAT
126           Sets the compatibility mode. The value can be set to either
127           MEMCACHED_KETAMA_COMPAT_LIBMEMCACHED (this is the default) or
128           MEMCACHED_KETAMA_COMPAT_SPY to be compatible with the SPY Memcached
129           client for Java.
130
131       MEMCACHED_BEHAVIOR_POLL_TIMEOUT
132           Modify the timeout value that is used by poll(). The default value
133           is -1. An signed int pointer must be passed to
134           memcached_behavior_set() to change this value. For
135           memcached_behavior_get() a signed int value will be cast and
136           returned as the unsigned long long.
137
138       MEMCACHED_BEHAVIOR_USER_DATA
139           This allows you to store a pointer to a specifc piece of data. This
140           can be retrieved from inside of memcached_fetch_execute(). Cloning
141           a memcached_st
142
143           will copy the pointer to the clone. This was deprecated in 0.14 in
144           favor of memcached_callback_set(3). This will be removed in 0.15.
145
146       MEMCACHED_BEHAVIOR_BUFFER_REQUESTS
147           Enabling buffered IO causes commands to "buffer" instead of being
148           sent. Any action that gets data causes this buffer to be be sent to
149           the remote connection. Quiting the connection or closing down the
150           connection will also cause the buffered data to be pushed to the
151           remote connection.
152
153       MEMCACHED_BEHAVIOR_VERIFY_KEY
154           Enabling this will cause libmemcached(3) to test all keys to verify
155           that they are valid keys.
156
157       MEMCACHED_BEHAVIOR_SORT_HOSTS
158           Enabling this will cause hosts that are added to be placed in the
159           host list in sorted order. This will defeat consisten hashing.
160
161       MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT
162           In non-blocking mode this changes the value of the timeout during
163           socket connection.
164
165       MEMCACHED_BEHAVIOR_BINARY_PROTOCOL
166           Enable the use of the binary protocol. Please note that you cannot
167           toggle this flag on an open connection.
168
169       MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT
170           Set this value to enable the server be removed after continuous
171           MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT times connection failure.
172
173       MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK
174           Set this value to tune the number of messages that may be sent
175           before libmemcached should start to automatically drain the input
176           queue. Setting this value to high, may cause libmemcached to
177           deadlock (trying to send data, but the send will block because the
178           input buffer in the kernel is full).
179
180       MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK
181           Set this value to tune the number of bytes that may be sent before
182           libmemcached should start to automatically drain the input queue
183           (need at least 10 IO requests sent without reading the input
184           buffer). Setting this value to high, may cause libmemcached to
185           deadlock (trying to send data, but the send will block because the
186           input buffer in the kernel is full).
187
188       MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH
189           The binary protocol works a bit different than the textual protocol
190           in that a multiget is implemented as a pipe of single get-
191           operations which are sent to the server in a chunk. If you are
192           using large multigets from your application, you may improve the
193           latency of the gets by setting this value so you send out the first
194           chunk of requests when you hit the specified limit.  It allows the
195           servers to start processing the requests to send the data back
196           while the rest of the requests are created and sent to the server.
197
198       MEMCACHED_BEHAVIOR_NOREPLY
199           Set this value to specify that you really don't care about the
200           result from your storage commands (set, add, replace, append,
201           prepend).
202
203       MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS
204           If you just want "a poor mans HA", you may specify the numbers of
205           replicas libmemcached should store of each item (on different
206           servers).  This replication does not dedicate certain memcached
207           servers to store the replicas in, but instead it will store the
208           replicas together with all of the other objects (on the 'n' next
209           servers specified in your server list).
210
211       MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ
212           Allows randomizing the replica reads starting point. Normally the
213           read is done from primary server and in case of miss the read is
214           done from primary + 1, then primary + 2 all the way to 'n'
215           replicas. If this option is set on the starting point of the
216           replica reads is randomized between the servers.  This allows
217           distributing read load to multiple servers with the expense of more
218           write traffic.
219
220       MEMCACHED_BEHAVIOR_CORK
221           Enable TCP_CORK behavior. This is only available as an option
222           Linux.  MEMCACHED_NO_SERVERS is returned if no servers are
223           available to test with.  MEMCACHED_NOT_SUPPORTED is returned if we
224           were not able to determine if support was available. All other
225           responses then MEMCACHED_SUCCESS report an error of some sort. This
226           behavior also enables MEMCACHED_BEHAVIOR_TCP_NODELAY when set.
227
228       MEMCACHED_BEHAVIOR_KEEPALIVE
229           Enable TCP_KEEPALIVE behavior.
230
231       MEMCACHED_BEHAVIOR_KEEPALIVE_IDLE
232           Specify time, in seconds, to mark a connection as idle. This is
233           only available as an option Linux.
234
235       MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE
236           Find the current size of SO_SNDBUF. A value of 0 means either an
237           error occured or no hosts were available. It is safe to assume
238           system default if this occurs.
239
240       MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE
241           Find the current size of SO_RCVBUF. A value of 0 means either an
242           error occured or no hosts were available. It is safe to assume
243           system default if this occurs.
244
245       MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT
246           This number of times a host can have an error before it is
247           disabled.
248
249       MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS
250           If enabled any hosts which have been flagged as disabled will be
251           removed from the list of servers in the memcached_st structure.
252           This must be used in combination with
253           MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT.
254
255       MEMCACHED_BEHAVIOR_RETRY_TIMEOUT
256           When enabled a host which is problematic will only be checked for
257           usage based on the amount of time set by this behavior.
258

RETURN

260       memcached_behavior_get() returns either the current value of the get,
261       or 0 or 1 on simple flag behaviors (1 being enabled).
262       memcached_behavior_set() returns failure or success.
263

NOTES

265       memcached_behavior_set() in version .17 was changed from taking a
266       pointer to data value, to taking a uin64_t.
267

HOME

269       To find out more information please check:
270       <https://launchpad.net/libmemcached>
271

AUTHOR

273       Brian Aker, <brian@tangent.org>
274

SEE ALSO

276       memcached(1) libmemcached(3) memcached_strerror(3)
277
278
279
280                                  2010-06-28     memcached_behavior_get.pop(3)
Impressum