Issue 152: Add cache for project info
This commit is contained in:
parent
3f699e0afd
commit
490ce3dd08
@ -108,6 +108,7 @@ class IDF_Conf extends Pluf_Model
|
||||
$conf->vdesc = $value;
|
||||
$conf->create();
|
||||
$this->initCache();
|
||||
$this->_project->invalidateConfCache();
|
||||
}
|
||||
|
||||
function getVal($key, $default='')
|
||||
|
@ -161,6 +161,14 @@ class IDF_Project extends Pluf_Model
|
||||
);
|
||||
}
|
||||
|
||||
public function invalidateConfCache() {
|
||||
$cache = Pluf_Cache::factory();
|
||||
$keys = $this->getConf()->getKeys();
|
||||
foreach($keys as $key) {
|
||||
$cache->set("confCache" . $this->id . $key, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* String representation of the abstract.
|
||||
@ -670,7 +678,14 @@ GROUP BY uid";
|
||||
return parent::__get($key);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return $this->getConf()->getVal($key);
|
||||
$cache = Pluf_Cache::factory();
|
||||
if (null === ($confCache = $cache->get("confCache" . $this->id . $key, null))) {
|
||||
$confCache = $this->getConf()->getVal($key);
|
||||
$cache->set("confCache" . $this->id . $key, $confCache);
|
||||
return $confCache;
|
||||
} else {
|
||||
return $confCache;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,14 +10,17 @@
|
||||
{/if}{if $customForgePageEnabled}
|
||||
<li><a href="{url 'IDF_Views::index'}">{trans 'Home'}</a></li>
|
||||
{/if}<li id="project-list"><a href="{url 'IDF_Views::listProjects'}">{trans 'Project List'} ▾</a>
|
||||
{if $allProjects.count() != 0}
|
||||
|
||||
{if $allProjects.count() != 0}
|
||||
<ul class="prjlistclass">
|
||||
<li id="searchkeep"><input size="15" type="text" id="prjname" name="prjname" placeholder="Project Name..." /></li>
|
||||
{foreach $allProjects as $p}
|
||||
<li class="projectitem"><a href="{url 'IDF_Views_Project::home', array($p.shortname)}"><img src="{media '/idf/img/no_logo.png'}" data-logo="{$p.logo}" class="logo" data-src="{url 'IDF_Views_Project::logo64', array($p.shortname)}" alt="{trans 'Project logo'}" />{if $p.private}<img class="lock" src="{media '/idf/img/lock.png'}" alt="{trans 'Private project'}" />{/if}{$p}</a></li>
|
||||
{/foreach}</ul>
|
||||
{/if}</li>{if $isAdmin}<li><a href="{url 'IDF_Views_Admin::forge'}">{trans 'Forge Management'} {if $pendingProjects > 0}({$pendingProjects}){/if}</a></li>{/if}<li>
|
||||
<li class="projectitem"><a href="{url 'IDF_Views_Project::home', array($p.shortname)}"><img src="{media '/idf/img/no_logo.png'}" data-logo="{$p.logo}" class="logo" data-src="{url 'IDF_Views_Project::logo64', array($p.shortname)}" alt="{trans 'Project logo'}" />{if $p.private}<img class="lock" src="{media '/idf/img/lock.png'}" alt="{trans 'Private project'}" />{/if}{$p}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
</li>{if $isAdmin}<li><a href="{url 'IDF_Views_Admin::forge'}">{trans 'Forge Management'} {if $pendingProjects > 0}({$pendingProjects}){/if}</a></li>{/if}<li>
|
||||
<a href="{url 'IDF_Views::faq'}" title="{trans 'Help and accessibility features'}">{trans 'Help'}</a></li>
|
||||
</ul>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user