+ [refac] add a method to clear dao cache.

This commit is contained in:
liugang
2024-08-02 15:24:27 +08:00
committed by 孙广明
parent 3880381499
commit da8a16228f
6 changed files with 36 additions and 4 deletions
+13
View File
@@ -614,4 +614,17 @@ class admin extends control
$this->view->title = $this->lang->admin->cache;
$this->display();
}
/**
* 清除数据缓存。
* Clear data cache.
*
* @access public
* @return void
*/
public function ajaxClearCache()
{
$this->dao->clearCache();
return $this->send(array('result' => 'success', 'message' => $this->lang->admin->clearSuccess, 'load' => true));
}
}
+4 -1
View File
@@ -53,9 +53,12 @@ $lang->admin->engineInfo = "The <strong>%s</strong> table engine is <strong>
$lang->admin->engineSummary['hasMyISAM'] = "There are %s tables that are not InnoDB engines";
$lang->admin->engineSummary['allInnoDB'] = "All tables are InnoDB engines";
$lang->admin->daoCache = 'DAO Cache';
$lang->admin->daoCache = 'Data Cache';
$lang->admin->clearCache = 'Clear';
$lang->admin->clearSuccess = 'Cleared';
$lang->admin->memory = 'Memory';
$lang->admin->usedMemory = 'Total %s, %s used';
$lang->admin->apcuNotice = 'Data cache is based on the PHP-APCu extension, which needs to be loaded before enabling.';
$lang->admin->apcuNotLoaded = 'Please load the APCu extension before enabling DAO cache';
$lang->admin->apcuNotEnabled = 'Please enable the apc.enabled option before enabling DAO cache';
+4 -1
View File
@@ -53,9 +53,12 @@ $lang->admin->engineInfo = "The <strong>%s</strong> table engine
$lang->admin->engineSummary['hasMyISAM'] = "There are %s tables that are not InnoDB engines";
$lang->admin->engineSummary['allInnoDB'] = "All tables are InnoDB engines";
$lang->admin->daoCache = 'DAO Cache';
$lang->admin->daoCache = 'Data Cache';
$lang->admin->clearCache = 'Clear';
$lang->admin->clearSuccess = 'Cleared';
$lang->admin->memory = 'Memory';
$lang->admin->usedMemory = 'Total %s, %s used';
$lang->admin->apcuNotice = 'Data cache is based on the PHP-APCu extension, which needs to be loaded before enabling.';
$lang->admin->apcuNotLoaded = 'Please load the APCu extension before enabling DAO cache';
$lang->admin->apcuNotEnabled = 'Please enable the apc.enabled option before enabling DAO cache';
+4 -1
View File
@@ -53,9 +53,12 @@ $lang->admin->engineInfo = "The <strong>%s</strong> table engine is <strong>
$lang->admin->engineSummary['hasMyISAM'] = "There are %s tables that are not InnoDB engines";
$lang->admin->engineSummary['allInnoDB'] = "All tables are InnoDB engines";
$lang->admin->daoCache = 'DAO Cache';
$lang->admin->daoCache = 'Data Cache';
$lang->admin->clearCache = 'Clear';
$lang->admin->clearSuccess = 'Cleared';
$lang->admin->memory = 'Memory';
$lang->admin->usedMemory = 'Total %s, %s used';
$lang->admin->apcuNotice = 'Data cache is based on the PHP-APCu extension, which needs to be loaded before enabling.';
$lang->admin->apcuNotLoaded = 'Please load the APCu extension before enabling DAO cache';
$lang->admin->apcuNotEnabled = 'Please enable the apc.enabled option before enabling DAO cache';
+3
View File
@@ -54,8 +54,11 @@ $lang->admin->engineSummary['hasMyISAM'] = "有%s个表不是InnoDB引擎";
$lang->admin->engineSummary['allInnoDB'] = "所有的表都是InnoDB引擎了";
$lang->admin->daoCache = '数据缓存';
$lang->admin->clearCache = '清除缓存';
$lang->admin->clearSuccess = '清除成功';
$lang->admin->memory = '内存使用';
$lang->admin->usedMemory = '总计 %s,已使用 %s';
$lang->admin->apcuNotice = '数据缓存基于 PHP-APCu 扩展实现,开启前需要先加载 APCu 扩展。';
$lang->admin->apcuNotLoaded = '请加载 APCu 扩展后再开启数据缓存';
$lang->admin->apcuNotEnabled = '请启用 apc.enabled 选项后再开启数据缓存';
+8 -1
View File
@@ -12,6 +12,12 @@ namespace zin;
formPanel
(
set::actions
([
'submit',
$config->cache->dao->enable ? ['text' => $lang->admin->clearCache, 'url' => inlink('ajaxClearCache'), 'class' => 'secondary ajax-submit'] : null,
'cancel'
]),
formGroup
(
set::label($lang->admin->daoCache),
@@ -21,7 +27,8 @@ formPanel
set::items($lang->admin->cacheStatusList),
set::value($config->cache->dao->enable),
set::inline(true)
)
),
span(setClass('ml-4 mt-1.5'), icon('info text-warning mr-2'), $lang->admin->apcuNotice)
),
helper::isAPCuEnabled() && $this->config->cache->dao->driver == 'Apcu' ? formRow
(