From fbe6a57866191d19aa6871abf111c5428be2a0ed Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Tue, 15 Oct 2019 11:56:02 +0200 Subject: Use a distributed cache for the isCachedCache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/private/Template/SCSSCacher.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php index 9bdaca3a674..1ddb4ff59dd 100644 --- a/lib/private/Template/SCSSCacher.php +++ b/lib/private/Template/SCSSCacher.php @@ -117,7 +117,7 @@ class SCSSCacher { $this->serverRoot = $serverRoot; $this->cacheFactory = $cacheFactory; $this->depsCache = $cacheFactory->createDistributed('SCSS-deps-' . md5($this->urlGenerator->getBaseUrl())); - $this->isCachedCache = $cacheFactory->createLocal('SCSS-cached-' . md5($this->urlGenerator->getBaseUrl())); + $this->isCachedCache = $cacheFactory->createDistributed('SCSS-cached-' . md5($this->urlGenerator->getBaseUrl())); $lockingCache = $cacheFactory->createDistributed('SCSS-locks-' . md5($this->urlGenerator->getBaseUrl())); if (!($lockingCache instanceof IMemcache)) { $lockingCache = new NullCache(); -- cgit v1.2.3 From 53f8f21cc97386c123cef1d833be1c556f63297d Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Tue, 15 Oct 2019 11:56:27 +0200 Subject: Make sure the cache is only reset once at a time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- lib/private/Template/SCSSCacher.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php index 1ddb4ff59dd..c6d5fc8ef71 100644 --- a/lib/private/Template/SCSSCacher.php +++ b/lib/private/Template/SCSSCacher.php @@ -269,8 +269,8 @@ class SCSSCacher { private function variablesChanged(): bool { $injectedVariables = $this->getInjectedVariables(); if ($this->config->getAppValue('core', 'theming.variables') !== md5($injectedVariables)) { - $this->resetCache(); $this->config->setAppValue('core', 'theming.variables', md5($injectedVariables)); + $this->resetCache(); return true; } return false; @@ -364,6 +364,9 @@ class SCSSCacher { * We need to regenerate all files when variables change */ public function resetCache() { + if (!$this->lockingCache->add('resetCache', 'locked!', 120)) { + return; + } $this->injectedVariables = null; // do not clear locks @@ -381,6 +384,7 @@ class SCSSCacher { } } $this->logger->debug('SCSSCacher: css cache cleared!'); + $this->lockingCache->remove('resetCache'); } /** -- cgit v1.2.3