+ installModel: enable dao cache by if apcu is enabled.

This commit is contained in:
liugang
2024-06-04 14:20:12 +08:00
committed by caoyanyi
parent c8b4eef8db
commit 8147db5605
+22
View File
@@ -418,4 +418,26 @@ class installModel extends model
return true;
}
/**
* 开启 dao 缓存。
* Enable dao cache.
*
* @access public
* @return bool
*/
public function enableDaoCache(): bool
{
if(!helper::isAPCuEnabled()) return false;
$cache = new stdclass();
$cache->owner = 'system';
$cache->module = 'common';
$cache->section = 'global';
$cache->key = 'cache';
$cache->value = '{"dao":{"enable":"1"}}';
$this->dao->replace(TABLE_CONFIG)->data($cache)->exec();
return !dao::isError();
}
}