fix(ratelimit): Only use memory cache backend for redis

Signed-off-by: Anna Larch <anna@nextcloud.com>
This commit is contained in:
Joas Schilling 2023-08-29 08:04:25 +02:00 committed by backportbot-nextcloud[bot]
parent 325e42f2b3
commit 52d68d3109

View file

@ -846,8 +846,8 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerDeprecatedAlias('Search', ISearch::class);
$this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) {
$cacheFactory = $c->get(ICacheFactory::class);
if ($cacheFactory->isAvailable()) {
$config = $c->get(\OCP\IConfig::class);
if (ltrim($config->getSystemValueString('memcache.distributed', ''), '\\') === \OC\Memcache\Redis::class) {
$backend = new \OC\Security\RateLimiting\Backend\MemoryCacheBackend(
$c->get(AllConfig::class),
$this->get(ICacheFactory::class),