Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't use deprecated method for requesting memcache #7531

Merged
merged 3 commits into from
Dec 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/files_sharing/lib/External/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions apps/theming/lib/ThemingDefaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/theming/tests/ThemingDefaultsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion apps/user_ldap/lib/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion apps/user_ldap/lib/Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/Command/Maintenance/UpdateTheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -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('<info>Image cache cleared');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/App/AppManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/ObjectStore/Swift.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/IntegrityCheck/Checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/OCS/DiscoveryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/private/Security/RateLimiting/Backend/MemoryCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/TemplateLayout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
Expand Down
2 changes: 1 addition & 1 deletion lib/private/URLGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/private/legacy/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions settings/ajax/uninstallapp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Command/Maintenance/UpdateTheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/App/AppManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/IntegrityCheck/CheckerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down