+ Cache for contribute.

This commit is contained in:
Lufei
2023-06-05 16:48:43 +08:00
parent 979456571b
commit 4036b05def
+10 -1
View File
@@ -418,7 +418,16 @@ class block extends control
*/
public function contribute()
{
$this->view->data = $this->loadModel('user')->getPersonalData();
if($this->config->cache->enable && $this->cache->has('contributeBlockData'))
{
$data = $this->cache->get('contributeBlockData');
}
else
{
$data = $this->loadModel('user')->getPersonalData();
if($this->config->cache->enable) $this->cache->set('contributeBlockData', $data);
}
$this->view->data = $data;
$this->display();
}