From 3090348bf724d959da08990f4f2d9abf7281f9af Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Thu, 11 Jun 2015 00:44:13 +0200 Subject: Null -> NullCache --- lib/private/memcache/factory.php | 4 +-- lib/private/memcache/null.php | 65 -------------------------------------- lib/private/memcache/nullcache.php | 65 ++++++++++++++++++++++++++++++++++++++ lib/private/server.php | 4 +-- 4 files changed, 68 insertions(+), 70 deletions(-) delete mode 100644 lib/private/memcache/null.php create mode 100644 lib/private/memcache/nullcache.php diff --git a/lib/private/memcache/factory.php b/lib/private/memcache/factory.php index 6e9aaa11d85..5e3d857006c 100644 --- a/lib/private/memcache/factory.php +++ b/lib/private/memcache/factory.php @@ -29,7 +29,7 @@ namespace OC\Memcache; use \OCP\ICacheFactory; class Factory implements ICacheFactory { - const NULL_CACHE = '\\OC\\Memcache\\Null'; + const NULL_CACHE = '\\OC\\Memcache\\NullCache'; /** * @var string $globalPrefix @@ -70,7 +70,7 @@ class Factory implements ICacheFactory { } if (!($lockingCacheClass && $lockingCacheClass::isAvailable())) { // dont fallback since the fallback might not be suitable for storing lock - $lockingCacheClass = '\OC\Memcache\Null'; + $lockingCacheClass = '\OC\Memcache\NullCache'; } $this->localCacheClass = $localCacheClass; $this->distributedCacheClass = $distributedCacheClass; diff --git a/lib/private/memcache/null.php b/lib/private/memcache/null.php deleted file mode 100644 index 982f7edc80f..00000000000 --- a/lib/private/memcache/null.php +++ /dev/null @@ -1,65 +0,0 @@ - - * @author Robin McCorkell - * - * @copyright Copyright (c) 2015, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see - * - */ - -namespace OC\Memcache; - -class Null extends Cache implements \OCP\IMemcache { - public function get($key) { - return null; - } - - public function set($key, $value, $ttl = 0) { - return true; - } - - public function hasKey($key) { - return false; - } - - public function remove($key) { - return true; - } - - public function add($key, $value, $ttl = 0) { - return true; - } - - public function inc($key, $step = 1) { - return true; - } - - public function dec($key, $step = 1) { - return true; - } - - public function cas($key, $old, $new) { - return true; - } - - public function clear($prefix = '') { - return true; - } - - static public function isAvailable() { - return true; - } -} diff --git a/lib/private/memcache/nullcache.php b/lib/private/memcache/nullcache.php new file mode 100644 index 00000000000..77eadba4eba --- /dev/null +++ b/lib/private/memcache/nullcache.php @@ -0,0 +1,65 @@ + + * @author Robin McCorkell + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see + * + */ + +namespace OC\Memcache; + +class NullCache extends Cache implements \OCP\IMemcache { + public function get($key) { + return null; + } + + public function set($key, $value, $ttl = 0) { + return true; + } + + public function hasKey($key) { + return false; + } + + public function remove($key) { + return true; + } + + public function add($key, $value, $ttl = 0) { + return true; + } + + public function inc($key, $step = 1) { + return true; + } + + public function dec($key, $step = 1) { + return true; + } + + public function cas($key, $old, $new) { + return true; + } + + public function clear($prefix = '') { + return true; + } + + static public function isAvailable() { + return true; + } +} diff --git a/lib/private/server.php b/lib/private/server.php index 8113080977f..6e4f1517c12 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -46,7 +46,6 @@ use OC\Lock\MemcacheLockingProvider; use OC\Lock\NoopLockingProvider; use OC\Mail\Mailer; use OC\Memcache\ArrayCache; -use OC\Memcache\Null as NullCache; use OC\Http\Client\ClientService; use OC\Security\CertificateManager; use OC\Files\Node\Root; @@ -57,7 +56,6 @@ use OC\Security\SecureRandom; use OC\Diagnostics\NullEventLogger; use OC\Security\TrustedDomainHelper; use OCP\IServerContainer; -use OCP\ISession; use OC\Tagging\TagMapper; /** @@ -429,7 +427,7 @@ class Server extends SimpleContainer implements IServerContainer { /** @var \OC\Memcache\Factory $memcacheFactory */ $memcacheFactory = $c->getMemCacheFactory(); $memcache = $memcacheFactory->createLocking('lock'); - if (!($memcache instanceof \OC\Memcache\Null)) { + if (!($memcache instanceof \OC\Memcache\NullCache)) { return new MemcacheLockingProvider($memcache); } } -- cgit v1.2.3