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>
This commit is contained in:
parent
ad3735ba27
commit
ed1dcd3651
|
@ -121,7 +121,9 @@ class JSCombiner {
|
||||||
$fileName = $fileName . '.deps';
|
$fileName = $fileName . '.deps';
|
||||||
try {
|
try {
|
||||||
$deps = $this->depsCache->get($folder->getName() . '-' . $fileName);
|
$deps = $this->depsCache->get($folder->getName() . '-' . $fileName);
|
||||||
|
$fromCache = true;
|
||||||
if ($deps === null || $deps === '') {
|
if ($deps === null || $deps === '') {
|
||||||
|
$fromCache = false;
|
||||||
$depFile = $folder->getFile($fileName);
|
$depFile = $folder->getFile($fileName);
|
||||||
$deps = $depFile->getContent();
|
$deps = $depFile->getContent();
|
||||||
}
|
}
|
||||||
|
@ -144,6 +146,10 @@ class JSCombiner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($fromCache === false) {
|
||||||
|
$this->depsCache->set($folder->getName() . '-' . $fileName, json_encode($deps));
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (NotFoundException $e) {
|
} catch (NotFoundException $e) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue