MEMCACHED_BEHAVIOR(3) | libmemcached-awesome | MEMCACHED_BEHAVIOR(3) |
memcached_behavior - libmemcached Documentation
Manipulate the behavior of a memcached_st structure.
Changed in version 0.17: The data argument of memcached_behavior_set() was changed from taking a pointer to data value, to taking a uin64_t.
The following operations will return MEMCACHED_NOT_SUPPORTED when executed with MEMCACHED_BEHAVIOR_USE_UDP enabled:
All other operations are tested 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.
libmemcached does not allow TCP and UDP servers to be shared within the same libmemcached client 'instance'. An attempt to add a TCP server when this behavior is enabled will result in a MEMCACHED_INVALID_HOST_PROTOCOL, as will attempting to add a UDP server when this behavior has not been enabled.
Each hash has its advantages and its weaknesses. If you don't know or don't care, just go with the default.
The default method is MEMCACHED_DISTRIBUTION_MODULA (hash of the key modulo number of servers).
You can enable consistent hashing by setting MEMCACHED_DISTRIBUTION_CONSISTENT. Consistent hashing delivers better distribution and allows servers to be added to the cluster with minimal cache losses.
Currently MEMCACHED_DISTRIBUTION_CONSISTENT is an alias for the value MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA.
Memcached can cache named lookups so that DNS lookups are made only once.
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).
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).
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.
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).
Requires the binary protocol and only supports (M)GET/SET/DELETE.
NOTE: libmemcached does not guarantee nor enforce any consistency.
This allows distributing read load to multiple servers with the expense of more write traffic.
NOTE: Only errors to communicate with a server are considered failures, so MEMCACHED_NOTFOUND does not account for failure.
If an error occurs you can check the last cached errno to find the specific error.
If an error occurs you can check the last cached errno to find the specific error.
Set this value to enable the server be removed after continuous MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT times connection failure.
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 MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT.
libmemcached behavior can be modified by using memcached_behavior_set(). 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, memcached_set() will always respond with MEMCACHED_SUCCESS).
memcached_behavior_get() takes a behavior flag and returns whether or not that behavior is currently enabled in the client.
memcached_behavior_set() changes the value of a particular option of the client. It takes both a flag and a value. For simple on or off options you just need to pass in a value of 1. Calls to memcached_behavior_set() will flush and reset all connections.
memcached_behavior_get() returns either the current value of the key, or 0 or 1 on simple flag behaviors (1 being enabled). memcached_behavior_set() returns failure or success.
The data argument of memcached_behavior_set() was changed in version 0.17 from taking a pointer to data value, to taking a uin64_t.
memcached(1) setsockopt(3) libmemcached(3) memcached_strerror(3)
March 6, 2023 | 1.1 |