Skip to content

Commit 144e864

Browse files
authored
Merge pull request #56033 from nextcloud/fix/cache-key
fix(Memcache): ensure global prefix depends on enabled apps
2 parents e4f06e1 + b4d1974 commit 144e864

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/private/Memcache/Factory.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,16 @@ protected function getGlobalPrefix(): string {
116116
$versions = [];
117117
if ($config->getValue('installed', false)) {
118118
$appConfig = \OCP\Server::get(IAppConfig::class);
119-
$versions = $appConfig->getAppInstalledVersions();
119+
// only get the enabled apps to clear the cache in case an app is enabled or disabled (e.g. clear routes)
120+
$versions = $appConfig->getAppInstalledVersions(true);
121+
ksort($versions);
120122
}
121123
$versions['core'] = implode('.', $this->serverVersion->getVersion());
122124

123125
// Include instanceid in the prefix, in case multiple instances use the same cache (e.g. same FPM pool)
124126
$instanceid = $config->getValue('instanceid');
125-
$this->globalPrefix = hash('xxh128', $instanceid . implode(',', $versions));
127+
$installedApps = implode(',', array_keys($versions)) . implode(',', array_values($versions));
128+
$this->globalPrefix = hash('xxh128', $instanceid . $installedApps);
126129
}
127130
return $this->globalPrefix;
128131
}

0 commit comments

Comments
 (0)