1..::docs::memcached_behavior(3)  libmemcached  ..::docs::memcached_behavior(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
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 dont know or dont care,
85           just go with the default.  Support for MEMCACHED_HASH_HSIEH is a
86           compile time option that is disabled by default. To enable support
87           for this hashing algorithm, configure and build libmemcached with
88           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_POLL_TIMEOUT
126           Modify the timeout value that is used by poll(). The default value
127           is -1. An signed int pointer must be passed to
128           memcached_behavior_set() to change this value. For
129           memcached_behavior_get() a signed int value will be cast and
130           returned as the unsigned long long.
131
132       MEMCACHED_BEHAVIOR_USER_DATA
133           This allows you to store a pointer to a specifc piece of data. This
134           can be retrieved from inside of memcached_fetch_execute(). Cloning
135           a memcached_st
136
137           will copy the pointer to the clone. This was deprecated in 0.14 in
138           favor of memcached_callback_set(3). This will be removed in 0.15.
139
140       MEMCACHED_BEHAVIOR_BUFFER_REQUESTS
141           Enabling buffered IO causes commands to "buffer" instead of being
142           sent. Any action that gets data causes this buffer to be be sent to
143           the remote connection. Quiting the connection or closing down the
144           connection will also cause the buffered data to be pushed to the
145           remote connection.
146
147       MEMCACHED_BEHAVIOR_VERIFY_KEY
148           Enabling this will cause libmemcached(3) to test all keys to verify
149           that they are valid keys.
150
151       MEMCACHED_BEHAVIOR_SORT_HOSTS
152           Enabling this will cause hosts that are added to be placed in the
153           host list in sorted order. This will defeat consisten hashing.
154
155       MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT
156           In non-blocking mode this changes the value of the timeout during
157           socket connection.
158
159       MEMCACHED_BEHAVIOR_BINARY_PROTOCOL
160           Enable the use of the binary protocol. Please note that you cannot
161           toggle this flag on an open connection.
162
163       MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT
164           Set this value to enable the server be removed after continuous
165           MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT times connection failure.
166
167       MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK
168           Set this value to tune the number of messages that may be sent
169           before libmemcached should start to automatically drain the input
170           queue. Setting this value to high, may cause libmemcached to
171           deadlock (trying to send data, but the send will block because the
172           input buffer in the kernel is full).
173
174       MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK
175           Set this value to tune the number of bytes that may be sent before
176           libmemcached should start to automatically drain the input queue
177           (need at least 10 IO requests sent without reading the input
178           buffer). Setting this value to high, may cause libmemcached to
179           deadlock (trying to send data, but the send will block because the
180           input buffer in the kernel is full).
181
182       MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH
183           The binary protocol works a bit different than the textual protocol
184           in that a multiget is implemented as a pipe of single get-
185           operations which are sent to the server in a chunk. If you are
186           using large multigets from your application, you may improve the
187           latency of the gets by setting this value so you send out the first
188           chunk of requests when you hit the specified limit.  It allows the
189           servers to start processing the requests to send the data back
190           while the rest of the requests are created and sent to the server.
191
192       MEMCACHED_BEHAVIOR_NOREPLY
193           Set this value to specify that you really don't care about the
194           result from your storage commands (set, add, replace, append,
195           prepend).
196
197       MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS
198           If you just want "a poor mans HA", you may specify the numbers of
199           replicas libmemcached should store of each item (on different
200           servers).  This replication does not dedicate certain memcached
201           servers to store the replicas in, but instead it will store the
202           replicas together with all of the other objects (on the 'n' next
203           servers specified in your server list).
204

RETURN

206       memcached_behavior_get() returns either the current value of the get,
207       or 0 or 1 on simple flag behaviors (1 being enabled).
208       memcached_behavior_set() returns failure or success.
209

NOTES

211       memcached_behavior_set() in version .17 was changed from taking a
212       pointer to data value, to taking a uin64_t.
213

HOME

215       To find out more information please check:
216       <http://tangent.org/552/libmemcached.html>
217

AUTHOR

219       Brian Aker, <brian@tangent.org>
220

SEE ALSO

222       memcached(1) libmemcached(3) memcached_strerror(3)
223
224
225
226                                  2009-06-27   ..::docs::memcached_behavior(3)
Impressum