aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Memcache
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2016-12-17 19:31:31 +0100
committerGitHub <noreply@github.com>2016-12-17 19:31:31 +0100
commita60479a3d363b538abeadc1065907213905709cd (patch)
tree90301c03d3f9c12c619a484e2000aa7cd726e688 /lib/private/Memcache
parentabf302bef8c81becbfcf1e059845cbaa70f219dc (diff)
parent46a7cb493f002779278426d1c05bc9f710de8c92 (diff)
downloadnextcloud-server-a60479a3d363b538abeadc1065907213905709cd.tar.gz
nextcloud-server-a60479a3d363b538abeadc1065907213905709cd.zip
Merge pull request #2725 from nextcloud/memcached-connect-once
[downstream] Set options, then add servers
Diffstat (limited to 'lib/private/Memcache')
-rw-r--r--lib/private/Memcache/Memcached.php21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/private/Memcache/Memcached.php b/lib/private/Memcache/Memcached.php
index f0cb4ae99db..dbff6dc2ec2 100644
--- a/lib/private/Memcache/Memcached.php
+++ b/lib/private/Memcache/Memcached.php
@@ -46,16 +46,6 @@ class Memcached extends Cache implements IMemcache {
parent::__construct($prefix);
if (is_null(self::$cache)) {
self::$cache = new \Memcached();
- $servers = \OC::$server->getSystemConfig()->getValue('memcached_servers');
- if (!$servers) {
- $server = \OC::$server->getSystemConfig()->getValue('memcached_server');
- if ($server) {
- $servers = array($server);
- } else {
- $servers = array(array('localhost', 11211));
- }
- }
- self::$cache->addServers($servers);
$defaultOptions = [
\Memcached::OPT_CONNECT_TIMEOUT => 50,
@@ -85,6 +75,17 @@ class Memcached extends Cache implements IMemcache {
} else {
throw new HintException("Expected 'memcached_options' config to be an array, got $options");
}
+
+ $servers = \OC::$server->getSystemConfig()->getValue('memcached_servers');
+ if (!$servers) {
+ $server = \OC::$server->getSystemConfig()->getValue('memcached_server');
+ if ($server) {
+ $servers = [$server];
+ } else {
+ $servers = [['localhost', 11211]];
+ }
+ }
+ self::$cache->addServers($servers);
}
}