.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" 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" '' . ds C` . ds C' '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 >0, 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. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Memcached::libmemcached::memcached_behavior 3pm" .TH Memcached::libmemcached::memcached_behavior 3pm "2020-11-09" "perl v5.32.0" "User Contributed Perl Documentation" .\" 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_t \& memcached_behavior_set (memcached_st *ptr, \& memcached_behavior flag, \& uint64_t data); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBlibmemcached\fR\|(3) behavior can be modified by use \fBmemcached_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, \fBmemcached_set()\fR will always respond with \&\f(CW\*(C`MEMCACHED_SUCCESS\*(C'\fR). .PP \&\fBmemcached_behavior_get()\fR takes a behavior flag and returns whether or not that behavior is currently enabled in the client. .PP \&\fBmemcached_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 \&\fBmemcached_behavior_set()\fR will flush and reset all connections. .IP "\s-1MEMCACHED_BEHAVIOR_USE_UDP\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_USE_UDP" Causes \fBlibmemcached\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: \fBmemcached_version()\fR, \fBmemcached_stat()\fR, \fBmemcached_get()\fR, \&\fBmemcached_get_by_key()\fR, \fBmemcached_mget()\fR, \fBmemcached_mget_by_key()\fR, \&\fBmemcached_fetch()\fR, \fBmemcached_fetch_result()\fR, \fBmemcached_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 \&\fBlibmemcached\fR\|(3) does not allow \s-1TCP\s0 and \s-1UDP\s0 servers to be shared within the same \fBlibmemached\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 \fBlibmemcached\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, 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,\s0 and \s-1MEMCACHED_HASH_MURMUR.\s0 Each hash has it's advantages and it's weaknesses. If you don't know or don't 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, MEMCACHED_HASH_MD5, MEMCACHED_HASH_CRC, MEMCACHED_HASH_FNV1_64, MEMCACHED_HASH_FNV1A_64, MEMCACHED_HASH_FNV1_32,\s0 and \s-1MEMCACHED_HASH_FNV1A_32.\s0 .IP "\s-1MEMCACHED_BEHAVIOR_KETAMA_COMPAT\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_KETAMA_COMPAT" Sets the compatibility mode. The value can be set to either \&\s-1MEMCACHED_KETAMA_COMPAT_LIBMEMCACHED\s0 (this is the default) or \&\s-1MEMCACHED_KETAMA_COMPAT_SPY\s0 to be compatible with the \s-1SPY\s0 Memcached client for Java. .IP "\s-1MEMCACHED_BEHAVIOR_POLL_TIMEOUT\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_POLL_TIMEOUT" Modify the timeout value that is used by \fBpoll()\fR. The default value is \-1. An signed int pointer must be passed to \fBmemcached_behavior_set()\fR to change this value. For \fBmemcached_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 \fBmemcached_fetch_execute()\fR. Cloning a memcached_st .Sp will copy the pointer to the clone. This was deprecated in 0.14 in favor of \fBmemcached_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 \fBlibmemcached\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). .IP "\s-1MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS" If you just want \*(L"a poor mans \s-1HA\*(R",\s0 you may specify the numbers of replicas libmemcached should store of each item (on different servers). This replication does not dedicate certain memcached servers to store the replicas in, but instead it will store the replicas together with all of the other objects (on the 'n' next servers specified in your server list). .IP "\s-1MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ" Allows randomizing the replica reads starting point. Normally the read is done from primary server and in case of miss the read is done from primary + 1, then primary + 2 all the way to 'n' replicas. If this option is set on the starting point of the replica reads is randomized between the servers. This allows distributing read load to multiple servers with the expense of more write traffic. .IP "\s-1MEMCACHED_BEHAVIOR_CORK\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_CORK" Enable \s-1TCP_CORK\s0 behavior. This is only available as an option Linux. \&\s-1MEMCACHED_NO_SERVERS\s0 is returned if no servers are available to test with. \&\s-1MEMCACHED_NOT_SUPPORTED\s0 is returned if we were not able to determine if support was available. All other responses then \s-1MEMCACHED_SUCCESS\s0 report an error of some sort. This behavior also enables \&\s-1MEMCACHED_BEHAVIOR_TCP_NODELAY\s0 when set. .IP "\s-1MEMCACHED_BEHAVIOR_KEEPALIVE\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_KEEPALIVE" Enable \s-1TCP_KEEPALIVE\s0 behavior. .IP "\s-1MEMCACHED_BEHAVIOR_KEEPALIVE_IDLE\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_KEEPALIVE_IDLE" Specify time, in seconds, to mark a connection as idle. This is only available as an option Linux. .IP "\s-1MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE" Find the current size of \s-1SO_SNDBUF. A\s0 value of 0 means either an error occurred or no hosts were available. It is safe to assume system default if this occurs. .IP "\s-1MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE" Find the current size of \s-1SO_RCVBUF. A\s0 value of 0 means either an error occurred or no hosts were available. It is safe to assume system default if this occurs. .IP "\s-1MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT" This number of times a host can have an error before it is disabled. .IP "\s-1MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS" If enabled any hosts which have been flagged as disabled will be removed from the list of servers in the memcached_st structure. This must be used in combination with \s-1MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT.\s0 .IP "\s-1MEMCACHED_BEHAVIOR_RETRY_TIMEOUT\s0" 4 .IX Item "MEMCACHED_BEHAVIOR_RETRY_TIMEOUT" When enabled a host which is problematic will only be checked for usage based on the amount of time set by this behavior. .SH "RETURN" .IX Header "RETURN" \&\fBmemcached_behavior_get()\fR returns either the current value of the get, or 0 or 1 on simple flag behaviors (1 being enabled). \fBmemcached_behavior_set()\fR returns failure or success. .SH "NOTES" .IX Header "NOTES" \&\fBmemcached_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" \&\fBmemcached\fR\|(1) \fBlibmemcached\fR\|(3) \fBmemcached_strerror\fR\|(3)