From 8147db56055e84a4cbdf2feb0c9d8295a368a28e Mon Sep 17 00:00:00 2001 From: liugang Date: Tue, 4 Jun 2024 14:02:35 +0800 Subject: [PATCH] + installModel: enable dao cache by if apcu is enabled. --- module/install/model.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/module/install/model.php b/module/install/model.php index 20c233da7d..680aaf18b4 100644 --- a/module/install/model.php +++ b/module/install/model.php @@ -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(); + } }