Added cache at the view level when displaying the source tree.
This commit is contained in:
parent
835eab9c24
commit
b2ec9bb9e8
@ -87,8 +87,12 @@ class IDF_Views_Source
|
|||||||
$branches[0]));
|
$branches[0]));
|
||||||
return new Pluf_HTTP_Response_Redirect($url);
|
return new Pluf_HTTP_Response_Redirect($url);
|
||||||
}
|
}
|
||||||
|
$cache = Pluf_Cache::factory();
|
||||||
|
$key = 'IDF_Views_Source::treeBase:'.$commit.'::';
|
||||||
|
if (null === ($res=$cache->get($key))) {
|
||||||
$res = new Pluf_Template_ContextVars($scm->filesAtCommit($commit));
|
$res = new Pluf_Template_ContextVars($scm->filesAtCommit($commit));
|
||||||
|
$cache->set($key, $res);
|
||||||
|
}
|
||||||
$cobject = $scm->getCommit($commit);
|
$cobject = $scm->getCommit($commit);
|
||||||
$tree_in = in_array($commit, $branches);
|
$tree_in = in_array($commit, $branches);
|
||||||
$scmConf = $request->conf->getVal('scm', 'git');
|
$scmConf = $request->conf->getVal('scm', 'git');
|
||||||
@ -154,7 +158,12 @@ class IDF_Views_Source
|
|||||||
$cobject = $scm->getCommit($commit);
|
$cobject = $scm->getCommit($commit);
|
||||||
$tree_in = in_array($commit, $branches);
|
$tree_in = in_array($commit, $branches);
|
||||||
try {
|
try {
|
||||||
|
$cache = Pluf_Cache::factory();
|
||||||
|
$key = 'IDF_Views_Source::tree:'.$commit.'::'.$request_file;
|
||||||
|
if (null === ($res=$cache->get($key))) {
|
||||||
$res = new Pluf_Template_ContextVars($scm->filesAtCommit($commit, $request_file));
|
$res = new Pluf_Template_ContextVars($scm->filesAtCommit($commit, $request_file));
|
||||||
|
$cache->set($key, $res);
|
||||||
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return new Pluf_HTTP_Response_Redirect($fburl);
|
return new Pluf_HTTP_Response_Redirect($fburl);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user