Merge pull request #6247 from owncloud/memcached-multiple-servers
Add support for multiple memcached servers. * owncloud/memcached-multiple-servers: Readd support for memcached_server config variable. Add support for multiple memcached servers.
This commit is contained in:
commit
bbfd97ce03
2 changed files with 18 additions and 4 deletions
|
@ -120,8 +120,14 @@ $CONFIG = array(
|
|||
/* Password to use for sendmail mail, depends on mail_smtpauth if this is used */
|
||||
"mail_smtppassword" => "",
|
||||
|
||||
/* memcached hostname and port (Only used when xCache, APC and APCu are absent.) */
|
||||
"memcached_server" => array('localhost', 11211),
|
||||
/* memcached servers (Only used when xCache, APC and APCu are absent.) */
|
||||
"memcached_servers" => array(
|
||||
// hostname, port and optional weight. Also see:
|
||||
// http://www.php.net/manual/en/memcached.addservers.php
|
||||
// http://www.php.net/manual/en/memcached.addserver.php
|
||||
array('localhost', 11211),
|
||||
//array('other.host.local', 11211),
|
||||
),
|
||||
|
||||
/* How long should ownCloud keep deleted files in the trash bin, default value: 30 days */
|
||||
'trashbin_retention_obligation' => 30,
|
||||
|
|
|
@ -18,8 +18,16 @@ class Memcached extends Cache {
|
|||
parent::__construct($prefix);
|
||||
if (is_null(self::$cache)) {
|
||||
self::$cache = new \Memcached();
|
||||
list($host, $port) = \OC_Config::getValue('memcached_server', array('localhost', 11211));
|
||||
self::$cache->addServer($host, $port);
|
||||
$servers = \OC_Config::getValue('memcached_servers');
|
||||
if (!$servers) {
|
||||
$server = \OC_Config::getValue('memcached_server');
|
||||
if ($server) {
|
||||
$servers = array($server);
|
||||
} else {
|
||||
$servers = array(array('localhost', 11211));
|
||||
}
|
||||
}
|
||||
self::$cache->addServers($servers);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue