Issue 152: Add cache for project info

This commit is contained in:
Nathan Adams
2016-04-23 15:28:24 -05:00
parent 3f699e0afd
commit 490ce3dd08
3 changed files with 24 additions and 5 deletions

View File

@@ -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;
}
}
}