Commit e7deee86 authored by robertDouglass's avatar robertDouglass
Browse files

#854516 by longwave: document use of OPT_BINARY_PROTOCOL and don't make it the default.

parent e4a21265
......@@ -202,18 +202,23 @@ configure memcached in settings.php. Please look here for possible options:
http://us2.php.net/manual/en/memcached.constants.php
An example configuration block is below, this block also illustrates our
default options. These will be set even if you add nothing to settings.php.
default options. These will be set unless overridden in settings.php.
$conf['memcache_options'] = array(
Memcached::OPT_COMPRESSION => false,
Memcached::OPT_COMPRESSION => FALSE,
Memcached::OPT_DISTRIBUTION => Memcached::DISTRIBUTION_CONSISTENT,
Memcached::OPT_BINARY_PROTOCOL => true,
);
These are as follows:
* Turn off compression, as compression takes more CPU cyles than it's worth
for most users
* Turn off compression, as this takes more CPU cycles than its worth for most
users
* Turn on consistent distribution, which allows you to add/remove servers
easily
* Turn on the binary protocol, which is more advanced and faster
If you are using memcached 1.4 or above, you should enable the binary protocol,
which is more advanced and faster, by adding the following to settings.php:
$conf['memcache_options'] = array(
Memcached::OPT_BINARY_PROTOCOL => TRUE,
);
......@@ -260,12 +260,14 @@ function dmemcache_object($bin = NULL, $flush = FALSE) {
// Create a new Memcache object. Each cluster gets its own Memcache object.
if (class_exists('Memcached')) {
$memcache = new Memcached;
$default_opts = array (
Memcached::OPT_COMPRESSION => false,
$default_opts = array(
Memcached::OPT_COMPRESSION => FALSE,
Memcached::OPT_DISTRIBUTION => Memcached::DISTRIBUTION_CONSISTENT,
Memcached::OPT_BINARY_PROTOCOL => true,
);
$memconf = variable_get('memcache_options', $default_opts);
foreach ($default_opts as $key => $value) {
$memcache->setOption($key, $value);
}
$memconf = variable_get('memcache_options', array());
foreach ($memconf as $key => $value) {
$memcache->setOption($key, $value);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment