From 82fab4d6215083d9951319ed367ff6c03324f55f Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 6 Jan 2021 16:15:17 +0100 Subject: [PATCH] Set the JSCombiner cache if needed Found while debugging a customer setup. They had to flush their Redis. Hence the info was no longer there. Since they also used S3 this meant requesting the files over and over on template render. Which on S3 is not cheap. Now we just write it back if we can't get it from the cache in the first place. So that the next run has it cached properly again. Signed-off-by: Roeland Jago Douma --- lib/private/Template/JSCombiner.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/private/Template/JSCombiner.php b/lib/private/Template/JSCombiner.php index 48f6dadfd6..caf6ec43da 100644 --- a/lib/private/Template/JSCombiner.php +++ b/lib/private/Template/JSCombiner.php @@ -121,7 +121,9 @@ class JSCombiner { $fileName = $fileName . '.deps'; try { $deps = $this->depsCache->get($folder->getName() . '-' . $fileName); + $fromCache = true; if ($deps === null || $deps === '') { + $fromCache = false; $depFile = $folder->getFile($fileName); $deps = $depFile->getContent(); } @@ -144,6 +146,10 @@ class JSCombiner { } } + if ($fromCache === false) { + $this->depsCache->set($folder->getName() . '-' . $fileName, json_encode($deps)); + } + return true; } catch (NotFoundException $e) { return false;