aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2021-01-06 16:15:17 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2021-01-06 16:15:17 +0100
commited1dcd365178d7a13ebeab5355b8ce00b0fdc59b (patch)
treea3c4e4e39064d4efba8f4798ce9acd24ee34a197
parentad3735ba27f7b17f3e07b29df165710ca65f3dbb (diff)
downloadnextcloud-server-ed1dcd365178d7a13ebeab5355b8ce00b0fdc59b.tar.gz
nextcloud-server-ed1dcd365178d7a13ebeab5355b8ce00b0fdc59b.zip
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 <roeland@famdouma.nl>
-rw-r--r--lib/private/Template/JSCombiner.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/private/Template/JSCombiner.php b/lib/private/Template/JSCombiner.php
index e9e4333c380..89ef9787f17 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;