diff options
author | Victor Dubiniuk <victor.dubiniuk@gmail.com> | 2016-12-09 22:46:41 +0300 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-12-16 17:56:39 +0100 |
commit | 46a7cb493f002779278426d1c05bc9f710de8c92 (patch) | |
tree | 77d030f6bf7fba90a4a2bfa4a9a4d8587ffbba9c | |
parent | b0c1460a1d7d71cb752637b42154cd515c2b489e (diff) | |
download | nextcloud-server-46a7cb493f002779278426d1c05bc9f710de8c92.tar.gz nextcloud-server-46a7cb493f002779278426d1c05bc9f710de8c92.zip |
Set options, then add servers
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
-rw-r--r-- | lib/private/Memcache/Memcached.php | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/private/Memcache/Memcached.php b/lib/private/Memcache/Memcached.php index 12f45739374..736a873ccb6 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); } } |