]> source.dussan.org Git - nextcloud-server.git/commitdiff
Cache deps list to memcache on write not on first read 4893/head
authorRoeland Jago Douma <roeland@famdouma.nl>
Tue, 16 May 2017 07:01:20 +0000 (09:01 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Tue, 16 May 2017 07:01:20 +0000 (09:01 +0200)
Fixes #4886

Caching on first read leads to the bug that if the files are updated we
will never cache again. Since we will always fetch from the memcache
(which works) and then see that the files are newer.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
lib/private/Template/JSCombiner.php

index 604cd2cceb7e475b594e748c96e183586ea6ee75..8254174bfc0516e4e57c1dafe92d55a889a1708d 100644 (file)
@@ -101,7 +101,6 @@ class JSCombiner {
                        if ($deps === null || $deps === '') {
                                $depFile = $folder->getFile($fileName);
                                $deps = $depFile->getContent();
-                               $this->depsCache->set($folder->getName() . '-' . $fileName, $deps);
                        }
                        $deps = json_decode($deps, true);
 
@@ -162,8 +161,11 @@ class JSCombiner {
 
                try {
                        $cachedfile->putContent($res);
-                       $depFile->putContent(json_encode($deps));
+                       $deps = json_encode($deps);
+                       $depFile->putContent($deps);
+                       $this->depsCache->set($folder->getName() . '-' . $depFileName, $deps);
                        $gzipFile->putContent(gzencode($res, 9));
+
                        return true;
                } catch (NotPermittedException $e) {
                        return false;