diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2015-02-04 12:15:40 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-02-16 18:05:43 +0100 |
commit | 87db136508f6599568eedf8f7696c6ebea4f56c1 (patch) | |
tree | 0e8ba0419671891d16d24a0e2df6e966db34f1a2 /lib/private | |
parent | 5a5d6bf4db0686c1e7b4ebeed0205547081a5d4c (diff) | |
download | nextcloud-server-87db136508f6599568eedf8f7696c6ebea4f56c1.tar.gz nextcloud-server-87db136508f6599568eedf8f7696c6ebea4f56c1.zip |
add debug log for memcache instantiation
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/memcache/factory.php | 22 | ||||
-rw-r--r-- | lib/private/server.php | 3 |
2 files changed, 19 insertions, 6 deletions
diff --git a/lib/private/memcache/factory.php b/lib/private/memcache/factory.php index e8a91c52269..537054a30f6 100644 --- a/lib/private/memcache/factory.php +++ b/lib/private/memcache/factory.php @@ -11,16 +11,19 @@ namespace OC\Memcache; use \OCP\ICacheFactory; class Factory implements ICacheFactory { - /** - * @var string $globalPrefix - */ + /** @var string $globalPrefix */ private $globalPrefix; + /** @var \OCP\ILogger */ + private $logger; + /** * @param string $globalPrefix + * @param \OCP\ILogger $logger */ - public function __construct($globalPrefix) { + public function __construct($globalPrefix, $logger) { $this->globalPrefix = $globalPrefix; + $this->logger = $logger; } /** @@ -32,16 +35,22 @@ class Factory implements ICacheFactory { function create($prefix = '') { $prefix = $this->globalPrefix . '/' . $prefix; if (XCache::isAvailable()) { + $this->logger->debug("creating XCache instance", array('app' => 'memcache')); return new XCache($prefix); } elseif (APCu::isAvailable()) { + $this->logger->debug('creating APCu instance', array('app'=>'memcache')); return new APCu($prefix); } elseif (APC::isAvailable()) { + $this->logger->debug('creating APC instance', array('app'=>'memcache')); return new APC($prefix); } elseif (Redis::isAvailable()) { + $this->logger->debug('creating redis instance', array('app'=>'memcache')); return new Redis($prefix); } elseif (Memcached::isAvailable()) { + $this->logger->debug('creating memcached instance', array('app'=>'memcache')); return new Memcached($prefix); } else { + $this->logger->debug('no cache available instance', array('app'=>'memcache')); return new ArrayCache($prefix); } } @@ -64,12 +73,16 @@ class Factory implements ICacheFactory { public function createLowLatency($prefix = '') { $prefix = $this->globalPrefix . '/' . $prefix; if (XCache::isAvailable()) { + $this->logger->debug('creating xcache instance for low latency', array('app'=>'memcache')); return new XCache($prefix); } elseif (APCu::isAvailable()) { + $this->logger->debug('creating APCu instance for low latency', array('app'=>'memcache')); return new APCu($prefix); } elseif (APC::isAvailable()) { + $this->logger->debug('creating APC instance for low latency', array('app'=>'memcache')); return new APC($prefix); } else { + $this->logger->debug('no low latency cache available', array('app'=>'memcache')); return null; } } @@ -83,5 +96,4 @@ class Factory implements ICacheFactory { return XCache::isAvailable() || APCu::isAvailable() || APC::isAvailable(); } - } diff --git a/lib/private/server.php b/lib/private/server.php index b023534ae21..9660597b39d 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -193,7 +193,8 @@ class Server extends SimpleContainer implements IServerContainer { }); $this->registerService('MemCacheFactory', function ($c) { $instanceId = \OC_Util::getInstanceId(); - return new \OC\Memcache\Factory($instanceId); + $logger = $c['Logger']; + return new \OC\Memcache\Factory($instanceId, $logger); }); $this->registerService('ActivityManager', function ($c) { return new ActivityManager(); |