diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2018-03-13 21:27:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-13 21:27:24 +0100 |
commit | 76d23a16006d0a05f3d6bd1cb29b873674162970 (patch) | |
tree | 27d204f0095846b1723e4d35f6765bf4e980fbfe /lib | |
parent | ede723f1b19c4c1afb7627af85c1e2f8d8a31386 (diff) | |
parent | dde5353f98668132f2a98312530b70029b07f30e (diff) | |
download | nextcloud-server-76d23a16006d0a05f3d6bd1cb29b873674162970.tar.gz nextcloud-server-76d23a16006d0a05f3d6bd1cb29b873674162970.zip |
Merge pull request #8806 from nextcloud/add-local-memcache-check
Properly provide local memcache check to ICacheFactory
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Memcache/Factory.php | 4 | ||||
-rw-r--r-- | lib/private/Server.php | 4 | ||||
-rw-r--r-- | lib/public/ICacheFactory.php | 8 |
3 files changed, 12 insertions, 4 deletions
diff --git a/lib/private/Memcache/Factory.php b/lib/private/Memcache/Factory.php index cb2cd8aabe2..8678c1b7999 100644 --- a/lib/private/Memcache/Factory.php +++ b/lib/private/Memcache/Factory.php @@ -185,11 +185,11 @@ class Factory implements ICacheFactory { } /** - * check local memcache availability + * Check if a local memory cache backend is available * * @return bool */ - public function isAvailableLowLatency(): bool { + public function isLocalCacheAvailable(): bool { return ($this->localCacheClass !== self::NULL_CACHE); } } diff --git a/lib/private/Server.php b/lib/private/Server.php index af739c91b02..b404af5613d 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -567,7 +567,7 @@ class Server extends ServerContainer implements IServerContainer { $this->registerService(\OCP\Route\IRouter::class, function (Server $c) { $cacheFactory = $c->getMemCacheFactory(); $logger = $c->getLogger(); - if ($cacheFactory->isAvailableLowLatency()) { + if ($cacheFactory->isLocalCacheAvailable()) { $router = new \OC\Route\CachingRouter($cacheFactory->createLocal('route'), $logger); } else { $router = new \OC\Route\Router($logger); @@ -581,7 +581,7 @@ class Server extends ServerContainer implements IServerContainer { }); $this->registerAlias('Search', \OCP\ISearch::class); - $this->registerService(\OC\Security\RateLimiting\Limiter::class, function ($c) { + $this->registerService(\OC\Security\RateLimiting\Limiter::class, function (Server $c) { return new \OC\Security\RateLimiting\Limiter( $this->getUserSession(), $this->getRequest(), diff --git a/lib/public/ICacheFactory.php b/lib/public/ICacheFactory.php index 76145fe1f78..a078543b092 100644 --- a/lib/public/ICacheFactory.php +++ b/lib/public/ICacheFactory.php @@ -52,6 +52,14 @@ interface ICacheFactory{ public function isAvailable(): bool; /** + * Check if a local memory cache backend is available + * + * @return bool + * @since 14.0.0 + */ + public function isLocalCacheAvailable(): bool; + + /** * create a cache instance for storing locks * * @param string $prefix |