diff --git a/apps/files_sharing/lib/External/Storage.php b/apps/files_sharing/lib/External/Storage.php index bae24e89e642f..638f82f7027fc 100644 --- a/apps/files_sharing/lib/External/Storage.php +++ b/apps/files_sharing/lib/External/Storage.php @@ -261,7 +261,7 @@ protected function testRemote() { * @return bool */ private function testRemoteUrl($url) { - $cache = $this->memcacheFactory->create('files_sharing_remote_url'); + $cache = $this->memcacheFactory->createDistributed('files_sharing_remote_url'); if($cache->hasKey($url)) { return (bool)$cache->get($url); } diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index fa43dd50ccd05..05d387e627379 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -240,7 +240,7 @@ public function getAndroidClientUrl() { * @return array scss variables to overwrite */ public function getScssVariables() { - $cache = $this->cacheFactory->create('theming'); + $cache = $this->cacheFactory->createDistributed('theming'); if ($value = $cache->get('getScssVariables')) { return $value; } @@ -307,7 +307,7 @@ public function replaceImagePath($app, $image) { * @return bool */ public function shouldReplaceIcons() { - $cache = $this->cacheFactory->create('theming'); + $cache = $this->cacheFactory->createDistributed('theming'); if($value = $cache->get('shouldReplaceIcons')) { return (bool)$value; } @@ -329,7 +329,7 @@ public function shouldReplaceIcons() { private function increaseCacheBuster() { $cacheBusterKey = $this->config->getAppValue('theming', 'cachebuster', '0'); $this->config->setAppValue('theming', 'cachebuster', (int)$cacheBusterKey+1); - $this->cacheFactory->create('theming')->clear('getScssVariables'); + $this->cacheFactory->createDistributed('theming')->clear('getScssVariables'); } /** diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php index 52bf88e51dd9c..843c1d34f9e0f 100644 --- a/apps/theming/tests/ThemingDefaultsTest.php +++ b/apps/theming/tests/ThemingDefaultsTest.php @@ -78,7 +78,7 @@ public function setUp() { $this->defaults = new \OC_Defaults(); $this->cacheFactory ->expects($this->any()) - ->method('create') + ->method('createDistributed') ->with('theming') ->willReturn($this->cache); $this->template = new ThemingDefaults( diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php index 1dcf9b72d7c67..bde489e271070 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -100,7 +100,7 @@ public function __construct(ILDAPWrapper $ldap, $configPrefix = '', $configID = !is_null($configID)); $memcache = \OC::$server->getMemCacheFactory(); if($memcache->isAvailable()) { - $this->cache = $memcache->create(); + $this->cache = $memcache->createDistributed(); } $helper = new Helper(\OC::$server->getConfig()); $this->doNotValidate = !in_array($this->configPrefix, diff --git a/apps/user_ldap/lib/Proxy.php b/apps/user_ldap/lib/Proxy.php index d372ff9c02674..dc8c6fc77cc61 100644 --- a/apps/user_ldap/lib/Proxy.php +++ b/apps/user_ldap/lib/Proxy.php @@ -50,7 +50,7 @@ public function __construct(ILDAPWrapper $ldap) { $this->ldap = $ldap; $memcache = \OC::$server->getMemCacheFactory(); if($memcache->isAvailable()) { - $this->cache = $memcache->create(); + $this->cache = $memcache->createDistributed(); } } diff --git a/core/Command/Maintenance/UpdateTheme.php b/core/Command/Maintenance/UpdateTheme.php index cf015b82635ff..2ab66a4ce7553 100644 --- a/core/Command/Maintenance/UpdateTheme.php +++ b/core/Command/Maintenance/UpdateTheme.php @@ -57,7 +57,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); // cleanup image cache - $c = $this->cacheFactory->create('imagePath'); + $c = $this->cacheFactory->createDistributed('imagePath'); $c->clear(''); $output->writeln('Image cache cleared'); } diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index 6be892b7f4917..e7d4668931c67 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -306,7 +306,7 @@ public function getAppPath($appId) { * Clear the cached list of apps when enabling/disabling an app */ public function clearAppsCache() { - $settingsMemCache = $this->memCacheFactory->create('settings'); + $settingsMemCache = $this->memCacheFactory->createDistributed('settings'); $settingsMemCache->clear('listApps'); } diff --git a/lib/private/Files/ObjectStore/Swift.php b/lib/private/Files/ObjectStore/Swift.php index ecfbe136e4c0e..629fb3ba7ff3d 100644 --- a/lib/private/Files/ObjectStore/Swift.php +++ b/lib/private/Files/ObjectStore/Swift.php @@ -82,7 +82,7 @@ public function __construct($params) { } $cacheFactory = \OC::$server->getMemCacheFactory(); - $this->memcache = $cacheFactory->create('swift::' . $cacheKey); + $this->memcache = $cacheFactory->createDistributed('swift::' . $cacheKey); $this->params = $params; } diff --git a/lib/private/IntegrityCheck/Checker.php b/lib/private/IntegrityCheck/Checker.php index ee7e35550a637..771ac891ab46d 100644 --- a/lib/private/IntegrityCheck/Checker.php +++ b/lib/private/IntegrityCheck/Checker.php @@ -87,7 +87,7 @@ public function __construct(EnvironmentHelper $environmentHelper, $this->fileAccessHelper = $fileAccessHelper; $this->appLocator = $appLocator; $this->config = $config; - $this->cache = $cacheFactory->create(self::CACHE_KEY); + $this->cache = $cacheFactory->createDistributed(self::CACHE_KEY); $this->appManager = $appManager; $this->tempManager = $tempManager; } diff --git a/lib/private/OCS/DiscoveryService.php b/lib/private/OCS/DiscoveryService.php index e547747da259a..4425947c55dac 100644 --- a/lib/private/OCS/DiscoveryService.php +++ b/lib/private/OCS/DiscoveryService.php @@ -46,7 +46,7 @@ class DiscoveryService implements IDiscoveryService { public function __construct(ICacheFactory $cacheFactory, IClientService $clientService ) { - $this->cache = $cacheFactory->create('ocs-discovery'); + $this->cache = $cacheFactory->createDistributed('ocs-discovery'); $this->client = $clientService->newClient(); } diff --git a/lib/private/Security/RateLimiting/Backend/MemoryCache.php b/lib/private/Security/RateLimiting/Backend/MemoryCache.php index 212df664c17ab..700fa624ed424 100644 --- a/lib/private/Security/RateLimiting/Backend/MemoryCache.php +++ b/lib/private/Security/RateLimiting/Backend/MemoryCache.php @@ -45,7 +45,7 @@ class MemoryCache implements IBackend { */ public function __construct(ICacheFactory $cacheFactory, ITimeFactory $timeFactory) { - $this->cache = $cacheFactory->create(__CLASS__); + $this->cache = $cacheFactory->createDistributed(__CLASS__); $this->timeFactory = $timeFactory; } diff --git a/lib/private/Server.php b/lib/private/Server.php index 6898e93e3bba5..8560ce1292ff6 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -952,7 +952,7 @@ public function __construct($webRoot, \OC\Config $config) { $c->getConfig(), $c->getThemingDefaults(), \OC::$SERVERROOT, - $cacheFactory->create('SCSS') + $cacheFactory->createDistributed('SCSS') ); }); $this->registerService(EventDispatcher::class, function () { diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index 997980aa5d743..264c10f5f1b66 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -291,7 +291,7 @@ static public function findJavascriptFiles($scripts) { new JSCombiner( \OC::$server->getAppDataDir('js'), \OC::$server->getURLGenerator(), - \OC::$server->getMemCacheFactory()->create('JS'), + \OC::$server->getMemCacheFactory()->createDistributed('JS'), \OC::$server->getSystemConfig(), \OC::$server->getLogger() ) diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php index 6fd22b99a6b66..f7d80d41b4fa6 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -151,7 +151,7 @@ public function linkTo( $app, $file, $args = array() ) { * Returns the path to the image. */ public function imagePath($app, $image) { - $cache = $this->cacheFactory->create('imagePath-'.md5($this->getBaseUrl()).'-'); + $cache = $this->cacheFactory->createDistributed('imagePath-'.md5($this->getBaseUrl()).'-'); $cacheKey = $app.'-'.$image; if($key = $cache->get($cacheKey)) { return $key; diff --git a/lib/private/legacy/helper.php b/lib/private/legacy/helper.php index e611b4d073217..8bbfb235ee2a6 100644 --- a/lib/private/legacy/helper.php +++ b/lib/private/legacy/helper.php @@ -497,7 +497,7 @@ public static function is_function_enabled($function_name) { * @return null|string */ public static function findBinaryPath($program) { - $memcache = \OC::$server->getMemCacheFactory()->create('findBinaryPath'); + $memcache = \OC::$server->getMemCacheFactory()->createDistributed('findBinaryPath'); if ($memcache->hasKey($program)) { return $memcache->get($program); } diff --git a/settings/ajax/uninstallapp.php b/settings/ajax/uninstallapp.php index b4a2468bd2a08..a932e2d79e97a 100644 --- a/settings/ajax/uninstallapp.php +++ b/settings/ajax/uninstallapp.php @@ -43,8 +43,8 @@ $result = OC_App::removeApp($appId); if($result !== false) { // FIXME: Clear the cache - move that into some sane helper method - \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-0'); - \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-1'); + \OC::$server->getMemCacheFactory()->createDistributed('settings')->remove('listApps-0'); + \OC::$server->getMemCacheFactory()->createDistributed('settings')->remove('listApps-1'); OC_JSON::success(array('data' => array('appid' => $appId))); } else { $l = \OC::$server->getL10N('settings'); diff --git a/tests/Core/Command/Maintenance/UpdateTheme.php b/tests/Core/Command/Maintenance/UpdateTheme.php index fbdea0b72b492..cbc417dbdbaa9 100644 --- a/tests/Core/Command/Maintenance/UpdateTheme.php +++ b/tests/Core/Command/Maintenance/UpdateTheme.php @@ -74,7 +74,7 @@ public function testThemeUpdate() { ->method('clear') ->with(''); $this->cacheFactory->expects($this->once()) - ->method('create') + ->method('createDistributed') ->with('imagePath') ->willReturn($cache); self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]); diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php index c2c0ea55072fd..c361db7b76b21 100644 --- a/tests/lib/App/AppManagerTest.php +++ b/tests/lib/App/AppManagerTest.php @@ -100,7 +100,7 @@ protected function setUp() { $this->cache = $this->createMock(ICache::class); $this->eventDispatcher = $this->createMock(EventDispatcherInterface::class); $this->cacheFactory->expects($this->any()) - ->method('create') + ->method('createDistributed') ->with('settings') ->willReturn($this->cache); $this->manager = new AppManager($this->userSession, $this->appConfig, $this->groupManager, $this->cacheFactory, $this->eventDispatcher); diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php index 049017cb5e88e..09e6990a0f386 100644 --- a/tests/lib/IntegrityCheck/CheckerTest.php +++ b/tests/lib/IntegrityCheck/CheckerTest.php @@ -60,7 +60,7 @@ public function setUp() { $this->cacheFactory ->expects($this->any()) - ->method('create') + ->method('createDistributed') ->with('oc.integritycheck.checker') ->will($this->returnValue(new NullCache())); diff --git a/tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php b/tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php index 34c326e72e118..bacd2b7bf6fb9 100644 --- a/tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php +++ b/tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php @@ -46,7 +46,7 @@ public function setUp() { $this->cacheFactory ->expects($this->once()) - ->method('create') + ->method('createDistributed') ->with('OC\Security\RateLimiting\Backend\MemoryCache') ->willReturn($this->cache);