diff --git a/lib/private/Memcache/Redis.php b/lib/private/Memcache/Redis.php index de67d9cf45138..38549511392a4 100644 --- a/lib/private/Memcache/Redis.php +++ b/lib/private/Memcache/Redis.php @@ -87,11 +87,11 @@ public function set($key, $value, $ttl = 0) { } public function hasKey($key) { - return (bool)self::$cache->exists($this->getPrefix() . $key); + return (bool)$this->getCache()->exists($this->getPrefix() . $key); } public function remove($key) { - if (self::$cache->del($this->getPrefix() . $key)) { + if ($this->getCache()->unlink($this->getPrefix() . $key)) { return true; } else { return false; @@ -101,8 +101,8 @@ public function remove($key) { public function clear($prefix = '') { // TODO: this is slow and would fail with Redis cluster $prefix = $this->getPrefix() . $prefix . '*'; - $keys = self::$cache->keys($prefix); - $deleted = self::$cache->del($keys); + $keys = this->getCache()->keys($prefix); + $deleted = $this->getCache()->del($keys); return (is_array($keys) && (count($keys) === $deleted)); } @@ -134,7 +134,7 @@ public function add($key, $value, $ttl = 0) { * @return int | bool */ public function inc($key, $step = 1) { - return self::$cache->incrBy($this->getPrefix() . $key, $step); + return $this->getCache()->incrBy($this->getPrefix() . $key, $step); } /** @@ -178,7 +178,7 @@ public function cad($key, $old) { } public function setTTL($key, $ttl) { - self::$cache->expire($this->getPrefix() . $key, $ttl); + $this->getCache()->expire($this->getPrefix() . $key, $ttl); } public static function isAvailable(): bool {