From 5c451ddc16013a5c808a46c669e489a375b692cd Mon Sep 17 00:00:00 2001 From: filesite Date: Sun, 7 Jul 2024 22:38:12 +0800 Subject: [PATCH] clean file cache when tajian task done --- themes/beauty/controller/ListController.php | 5 +++-- themes/beauty/controller/SiteController.php | 5 +++-- themes/tajian/controller/FrontapiController.php | 3 +++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/themes/beauty/controller/ListController.php b/themes/beauty/controller/ListController.php index 89cad17..6668a98 100644 --- a/themes/beauty/controller/ListController.php +++ b/themes/beauty/controller/ListController.php @@ -19,7 +19,8 @@ Class ListController extends Controller { $scanner->setWebRoot(FSC::$app['config']['content_directory']); //优先从缓存读取数据 - $cacheKey = 'allFilesTree'; + $prefix = FSC::$app['config']['theme']; + $cacheKey = "{$prefix}_allFilesTree"; $cachedData = Common::getCacheFromFile($cacheKey); if (!empty($cachedData)) { $dirTree = $cachedData; @@ -30,7 +31,7 @@ Class ListController extends Controller { } //优先从缓存读取数据 - $cacheKey = 'allFilesData'; + $cacheKey = "{$prefix}_allFilesData"; $cachedData = Common::getCacheFromFile($cacheKey); if (!empty($cachedData)) { $scanResults = $cachedData; diff --git a/themes/beauty/controller/SiteController.php b/themes/beauty/controller/SiteController.php index 5629ef3..f0482ed 100644 --- a/themes/beauty/controller/SiteController.php +++ b/themes/beauty/controller/SiteController.php @@ -19,7 +19,8 @@ Class SiteController extends Controller { $scanner->setWebRoot(FSC::$app['config']['content_directory']); //优先从缓存读取数据 - $cacheKey = 'allFilesTree'; + $prefix = FSC::$app['config']['theme']; + $cacheKey = "{$prefix}_allFilesTree"; $cachedData = Common::getCacheFromFile($cacheKey); if (!empty($cachedData)) { $dirTree = $cachedData; @@ -30,7 +31,7 @@ Class SiteController extends Controller { } //优先从缓存读取数据 - $cacheKey = 'allFilesData'; + $cacheKey = "{$prefix}_allFilesData"; $cachedData = Common::getCacheFromFile($cacheKey); if (!empty($cachedData)) { $scanResults = $cachedData; diff --git a/themes/tajian/controller/FrontapiController.php b/themes/tajian/controller/FrontapiController.php index d406c8a..2be4e8f 100644 --- a/themes/tajian/controller/FrontapiController.php +++ b/themes/tajian/controller/FrontapiController.php @@ -480,6 +480,9 @@ eof; $code = 0; $err = '签名验证不通过!'; }else if (!empty($task_result['done'])) { //如果任务成功抓取到数据 + //清空缓存 + $this->cleanAllFilesCache(); + $video_id = $this->getVideoId($task_result['url']); $saveUrlRes = $this->saveUrlShortCut($video_id, $task_result['url']); $saveDescRes = $this->saveDescriptionFiles($video_id, $task_result);