.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "..::docs::memcached_behavior 3" .TH ..::docs::memcached_behavior 3 "2012-10-24" "" "libmemcached" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" memcached_behavior_get, memcached_behavior_set \- Manipulate behavior .SH "LIBRARY" .IX Header "LIBRARY" C Client Library for memcached (libmemcached, \-lmemcached) .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& #include \& \& uint64_t \& memcached_behavior_get (memcached_st *ptr, \& memcached_behavior flag); \& \& memcached_return \& memcached_behavior_set (memcached_st *ptr, \& memcached_behavior flag, \& uint64_t data); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fIlibmemcached\fR\|(3) behavior can be modified by use \fImemcached_behavior_set()\fR. Default behavior is the library strives to be quick and accurate. Some behavior, while being faster, can also result in not entirely accurate behavior (for instance, \fImemcached_set()\fR will always respond with \&\f(CW\*(C`MEMCACHED_SUCCESS\*(C'\fR). .PP \&\fImemcached_behavior_get()\fR takes a behavior flag and returns whether or not that behavior is currently enabled in the client. .PP \&\fImemcached_behavior_set()\fR changes the value of a particular option of the client. It takes both a flag (listed below) and a value. For simple on or off options you just need to pass in a value of 1. Calls to \&\fImemcached_behavior_set()\fR will flush and reset all connections. .IP "\s-1MEMCACHED_BEHAVIOR_USE_UDP\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_USE_UDP" Causes \fIlibmemcached\fR\|(3) to use the \s-1UDP\s0 transport when communicating with a memcached server. Not all I/O operations are supported when this behavior is enababled. The following operations will return \&\f(CW\*(C`MEMCACHED_NOT_SUPPORTED\*(C'\fR when executed with the \s-1MEMCACHED_BEHAVIOR_USE_UDP\s0 enabled: \fImemcached_version()\fR, \fImemcached_stat()\fR, \fImemcached_get()\fR, \&\fImemcached_get_by_key()\fR, \fImemcached_mget()\fR, \fImemcached_mget_by_key()\fR, \&\fImemcached_fetch()\fR, \fImemcached_fetch_result()\fR, \fImemcached_value_fetch()\fR. .Sp All other operations are supported but are executed in a 'fire\-and\-forget' mode, in which once the client has executed the operation, no attempt will be made to ensure the operation has been received and acted on by the server. .Sp \&\fIlibmemcached\fR\|(3) does not allow \s-1TCP\s0 and \s-1UDP\s0 servers to be shared within the same \fIlibmemached\fR\|(3) client 'instance'. An attempt to add a \s-1TCP\s0 server when this behavior is enabled will result in a \f(CW\*(C`MEMCACHED_INVALID_HOST_PROTOCOL\*(C'\fR, as will attempting to add a \s-1UDP\s0 server when this behavior has not been enabled. .IP "\s-1MEMCACHED_BEHAVIOR_NO_BLOCK\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_NO_BLOCK" Causes \fIlibmemcached\fR\|(3) to use asychronous \s-1IO\s0. This is the fastest transport available for storage functions. .IP "\s-1MEMCACHED_BEHAVIOR_SND_TIMEOUT\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_SND_TIMEOUT" This sets the microsecond behavior of the socket against the \s-1SO_SNDTIMEO\s0 flag. In cases where you cannot use non-blocking \s-1IO\s0 this will allow you to still have timeouts on the sending of data. .IP "\s-1MEMCACHED_BEHAVIOR_RCV_TIMEOUT\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_RCV_TIMEOUT" This sets the microsecond behavior of the socket against the \s-1SO_RCVTIMEO\s0 flag. In cases where you cannot use non-blocking \s-1IO\s0 this will allow you to still have timeouts on the reading of data. .IP "\s-1MEMCACHED_BEHAVIOR_TCP_NODELAY\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_TCP_NODELAY" Turns on the no-delay feature for connecting sockets (may be faster in some environments). .IP "\s-1MEMCACHED_BEHAVIOR_HASH\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_HASH" Makes the default hashing algorithm for keys use \s-1MD5\s0. The value can be set to either \s-1MEMCACHED_HASH_DEFAULT\s0, \s-1MEMCACHED_HASH_MD5\s0, \s-1MEMCACHED_HASH_CRC\s0, \s-1MEMCACHED_HASH_FNV1_64\s0, \s-1MEMCACHED_HASH_FNV1A_64\s0, \s-1MEMCACHED_HASH_FNV1_32\s0, \s-1MEMCACHED_HASH_FNV1A_32\s0, \s-1MEMCACHED_HASH_JENKINS\s0, \s-1MEMCACHED_HASH_HSIEH\s0, and \s-1MEMCACHED_HASH_MURMUR\s0. Each hash has it's advantages and it's weaknesses. If you dont know or dont care, just go with the default. Support for \s-1MEMCACHED_HASH_HSIEH\s0 is a compile time option that is disabled by default. To enable support for this hashing algorithm, configure and build libmemcached with the \-\-enable\-hash_hsieh. .IP "\s-1MEMCACHED_BEHAVIOR_DISTRIBUTION\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_DISTRIBUTION" Using this you can enable different means of distributing values to servers. The default method is \s-1MEMCACHED_DISTRIBUTION_MODULA\s0. You can enable consistent hashing by setting \s-1MEMCACHED_DISTRIBUTION_CONSISTENT\s0. Consistent hashing delivers better distribution and allows servers to be added to the cluster with minimal cache losses. Currently \&\s-1MEMCACHED_DISTRIBUTION_CONSISTENT\s0 is an alias for the value \&\s-1MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA\s0. .IP "\s-1MEMCACHED_BEHAVIOR_CACHE_LOOKUPS\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_CACHE_LOOKUPS" Memcached can cache named lookups so that \s-1DNS\s0 lookups are made only once. .IP "\s-1MEMCACHED_BEHAVIOR_SUPPORT_CAS\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_SUPPORT_CAS" Support \s-1CAS\s0 operations (this is not enabled by default at this point in the server since it imposes a slight performance penalty). .IP "\s-1MEMCACHED_BEHAVIOR_KETAMA\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_KETAMA" Sets the default distribution to \s-1MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA\s0 and the hash to \s-1MEMCACHED_HASH_MD5\s0. .IP "\s-1MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED" Sets the default distribution to \s-1MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA\s0 with the weighted support. and the hash to \s-1MEMCACHED_HASH_MD5\s0. .IP "\s-1MEMCACHED_BEHAVIOR_KETAMA_HASH\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_KETAMA_HASH" Sets the hashing algorithm for host mapping on continuum. The value can be set to either \s-1MEMCACHED_HASH_DEFAULT\s0, \s-1MEMCACHED_HASH_MD5\s0, \s-1MEMCACHED_HASH_CRC\s0, \s-1MEMCACHED_HASH_FNV1_64\s0, \s-1MEMCACHED_HASH_FNV1A_64\s0, \s-1MEMCACHED_HASH_FNV1_32\s0, and \s-1MEMCACHED_HASH_FNV1A_32\s0. .IP "\s-1MEMCACHED_BEHAVIOR_POLL_TIMEOUT\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_POLL_TIMEOUT" Modify the timeout value that is used by \fIpoll()\fR. The default value is \-1. An signed int pointer must be passed to \fImemcached_behavior_set()\fR to change this value. For \fImemcached_behavior_get()\fR a signed int value will be cast and returned as the unsigned long long. .IP "\s-1MEMCACHED_BEHAVIOR_USER_DATA\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_USER_DATA" This allows you to store a pointer to a specifc piece of data. This can be retrieved from inside of \fImemcached_fetch_execute()\fR. Cloning a memcached_st .Sp will copy the pointer to the clone. This was deprecated in 0.14 in favor of \fImemcached_callback_set\fR\|(3). This will be removed in 0.15. .IP "\s-1MEMCACHED_BEHAVIOR_BUFFER_REQUESTS\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_BUFFER_REQUESTS" Enabling buffered \s-1IO\s0 causes commands to \*(L"buffer\*(R" instead of being sent. Any action that gets data causes this buffer to be be sent to the remote connection. Quiting the connection or closing down the connection will also cause the buffered data to be pushed to the remote connection. .IP "\s-1MEMCACHED_BEHAVIOR_VERIFY_KEY\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_VERIFY_KEY" Enabling this will cause \fIlibmemcached\fR\|(3) to test all keys to verify that they are valid keys. .IP "\s-1MEMCACHED_BEHAVIOR_SORT_HOSTS\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_SORT_HOSTS" Enabling this will cause hosts that are added to be placed in the host list in sorted order. This will defeat consisten hashing. .IP "\s-1MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT" In non-blocking mode this changes the value of the timeout during socket connection. .IP "\s-1MEMCACHED_BEHAVIOR_BINARY_PROTOCOL\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_BINARY_PROTOCOL" Enable the use of the binary protocol. Please note that you cannot toggle this flag on an open connection. .IP "\s-1MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT" Set this value to enable the server be removed after continuous \s-1MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT\s0 times connection failure. .IP "\s-1MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK" Set this value to tune the number of messages that may be sent before libmemcached should start to automatically drain the input queue. Setting this value to high, may cause libmemcached to deadlock (trying to send data, but the send will block because the input buffer in the kernel is full). .IP "\s-1MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK" Set this value to tune the number of bytes that may be sent before libmemcached should start to automatically drain the input queue (need at least 10 \s-1IO\s0 requests sent without reading the input buffer). Setting this value to high, may cause libmemcached to deadlock (trying to send data, but the send will block because the input buffer in the kernel is full). .IP "\s-1MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH" The binary protocol works a bit different than the textual protocol in that a multiget is implemented as a pipe of single get-operations which are sent to the server in a chunk. If you are using large multigets from your application, you may improve the latency of the gets by setting this value so you send out the first chunk of requests when you hit the specified limit. It allows the servers to start processing the requests to send the data back while the rest of the requests are created and sent to the server. .IP "\s-1MEMCACHED_BEHAVIOR_NOREPLY\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_NOREPLY" Set this value to specify that you really don't care about the result from your storage commands (set, add, replace, append, prepend). .SH "RETURN" .IX Header "RETURN" \&\fImemcached_behavior_get()\fR returns either the current value of the get, or 0 or 1 on simple flag behaviors (1 being enabled). \fImemcached_behavior_set()\fR returns failure or success. .SH "NOTES" .IX Header "NOTES" \&\fImemcached_behavior_set()\fR in version .17 was changed from taking a pointer to data value, to taking a uin64_t. .SH "HOME" .IX Header "HOME" To find out more information please check: .SH "AUTHOR" .IX Header "AUTHOR" Brian Aker, .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fImemcached\fR\|(1) \fIlibmemcached\fR\|(3) \fImemcached_strerror\fR\|(3)