root/lang/c/libmemcached-win32/libmemcached-latest/docs/memcached_behavior.pod @ 22355

Revision 22355, 6.7 kB (checked in by mattn, 5 years ago)

merge trunk.

Line 
1=head1 NAME
2
3memcached_behavior_get memcached_behavior_set
4
5=head1 LIBRARY
6
7C Client Library for memcached (libmemcached, -lmemcached)
8
9=head1 SYNOPSIS
10
11  #include <memcached.h>
12
13  uint64_t
14    memcached_behavior_get (memcached_st *ptr,
15                            memcached_behavior flag);
16
17  memcached_return
18    memcached_behavior_set (memcached_st *ptr,
19                            memcached_behavior flag,
20                            uint64_t data);
21
22=head1 DESCRIPTION
23
24libmemcached(3) behavior can be modified by use memcached_behavior_set().
25Default behavior is the library strives to be quick and accurate. Some
26behavior, while being faster, can also result in not entirely accurate
27behavior (for instance, memcached_set() will always respond with
28C<MEMCACHED_SUCCESS>).
29
30memcached_behavior_get() takes a behavior flag and returns whether or not
31that behavior is currently enabled in the client.
32
33memcached_behavior_set() changes the value of a particular option of the
34client. It takes both a flag (listed below) and a value. For simple on or
35off options you just need to pass in a value of 1. Calls to
36memcached_behavior_set() will flush and reset all connections.
37
38=over 4
39
40=item MEMCACHED_BEHAVIOR_NO_BLOCK
41
42Causes libmemcached(3) to use asychronous IO. This is the fastest transport
43available for storage functions. For read operations it is currently
44similar in performance to the non-blocking method (this is being
45looked into).
46
47=item MEMCACHED_BEHAVIOR_SND_TIMEOUT
48
49This sets the microsecond behavior of the socket against the SO_SNDTIMEO flag.
50In cases where you cannot use non-blocking IO this will allow you to still have
51timeouts on the sending of data.
52
53=item MEMCACHED_BEHAVIOR_RCV_TIMEOUT
54
55This sets the microsecond behavior of the socket against the SO_RCVTIMEO flag.
56In cases where you cannot use non-blocking IO this will allow you to still have
57timeouts on the reading of data.
58
59=item MEMCACHED_BEHAVIOR_TCP_NODELAY
60
61Turns on the no-delay feature for connecting sockets (may be faster in some
62environments).
63
64=item MEMCACHED_BEHAVIOR_HASH
65
66Makes the default hashing algorithm for keys use MD5. The value can be set
67to either MEMCACHED_HASH_DEFAULT, MEMCACHED_HASH_MD5, MEMCACHED_HASH_CRC, MEMCACHED_HASH_FNV1_64, MEMCACHED_HASH_FNV1A_64, MEMCACHED_HASH_FNV1_32, MEMCACHED_HASH_FNV1A_32, MEMCACHED_HASH_JENKINS, MEMCACHED_HASH_HSIEH, and MEMCACHED_HASH_MURMUR.
68Each hash has it's advantages and it's weaknesses. If you dont know or dont care, just go with the default.
69
70=item MEMCACHED_BEHAVIOR_DISTRIBUTION
71
72Using this you can enable different means of distributing values to servers.
73The default method is MEMCACHED_DISTRIBUTION_MODULA. You can enable
74consistent hashing by setting MEMCACHED_DISTRIBUTION_CONSISTENT.
75Consistent hashing delivers better distribution and allows servers to be
76added to the cluster with minimal cache losses. Currently
77MEMCACHED_DISTRIBUTION_CONSISTENT is an alias for the value
78MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA. 
79
80=item MEMCACHED_BEHAVIOR_CACHE_LOOKUPS
81
82Memcached can cache named lookups so that DNS lookups are made only once.
83
84=item MEMCACHED_BEHAVIOR_SUPPORT_CAS
85
86Support CAS operations (this is not enabled by default at this point in the server since it imposes a slight performance penalty).
87
88=item MEMCACHED_BEHAVIOR_KETAMA
89
90Sets the default distribution to MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA
91and the hash to MEMCACHED_HASH_MD5.
92
93=item MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED
94
95Sets the default distribution to MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA with the weighted support.
96and the hash to MEMCACHED_HASH_MD5.
97
98=item MEMCACHED_BEHAVIOR_KETAMA_HASH
99
100Sets the hashing algorithm for host mapping on continuum. The value can be set
101to either MEMCACHED_HASH_DEFAULT, MEMCACHED_HASH_MD5, MEMCACHED_HASH_CRC, MEMCACHED_HASH_FNV1_64, MEMCACHED_HASH_FNV1A_64, MEMCACHED_HASH_FNV1_32, and MEMCACHED_HASH_FNV1A_32.
102
103=item MEMCACHED_BEHAVIOR_POLL_TIMEOUT
104
105Modify the timeout value that is used by poll(). The default value is -1. An signed int pointer must be passed to memcached_behavior_set() to change this value. For memcached_behavior_get() a signed int value will be cast and returned as the unsigned long long.
106
107=item MEMCACHED_BEHAVIOR_USER_DATA
108
109This allows you to store a pointer to a specifc piece of data. This can be
110retrieved from inside of memcached_fetch_execute(). Cloning a memcached_st
111
112will copy the pointer to the clone. This was deprecated in 0.14 in favor
113of memcached_callback_set(3). This will be removed in 0.15.
114
115=item MEMCACHED_BEHAVIOR_BUFFER_REQUESTS
116
117Enabling buffered IO causes commands to "buffer" instead of being sent. Any
118action that gets data causes this buffer to be be sent to the remote
119connection. Quiting the connection or closing down the connection will also
120cause the buffered data to be pushed to the remote connection.
121
122=item MEMCACHED_BEHAVIOR_VERIFY_KEY
123
124Enabling this will cause libmemcached(3) to test all keys to verify that they
125are valid keys.
126
127=item MEMCACHED_BEHAVIOR_SORT_HOSTS
128
129Enabling this will cause hosts that are added to be placed in the host list in
130sorted order. This will defeat consisten hashing.
131
132=item MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT
133
134In non-blocking mode this changes the value of the timeout during socket
135connection.
136
137=item MEMCACHED_BEHAVIOR_BINARY_PROTOCOL
138
139Enable the use of the binary protocol. Please note that you cannot toggle
140this flag on an open connection.
141
142=item MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT
143
144Set this value to enable the server be removed after continuous MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT
145times connection failure.
146
147=item MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK
148
149Set this value to tune the number of messages that may be sent before
150libmemcached should start to automatically drain the input queue. Setting
151this value to high, may cause libmemcached to deadlock (trying to send data,
152but the send will block because the input buffer in the kernel is full).
153
154=item MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK
155
156Set this value to tune the number of bytes that may be sent before
157libmemcached should start to automatically drain the input queue (need
158at least 10 IO requests sent without reading the input buffer). Setting
159this value to high, may cause libmemcached to deadlock (trying to send
160data, but the send will block because the input buffer in the kernel is full).
161
162=back
163
164=head1 RETURN
165
166memcached_behavior_get() returns either the current value of the get, or 0
167or 1 on simple flag behaviors (1 being enabled). memcached_behavior_set()
168returns failure or success.
169
170=head1 NOTES
171
172memcached_behavior_set() in version .17 was changed from taking a pointer
173to data value, to taking a uin64_t.
174
175=head1 HOME
176
177To find out more information please check:
178L<http://tangent.org/552/libmemcached.html>
179
180=head1 AUTHOR
181
182Brian Aker, E<lt>brian@tangent.orgE<gt>
183
184=head1 SEE ALSO
185
186memcached(1) libmemcached(3) memcached_strerror(3)
187
188=cut
189
Note: See TracBrowser for help on using the browser.