Browse Source

clean file cache when tajian task done

master
filesite 5 months ago
parent
commit
5c451ddc16
  1. 5
      themes/beauty/controller/ListController.php
  2. 5
      themes/beauty/controller/SiteController.php
  3. 3
      themes/tajian/controller/FrontapiController.php

5
themes/beauty/controller/ListController.php

@ -19,7 +19,8 @@ Class ListController extends Controller {
$scanner->setWebRoot(FSC::$app['config']['content_directory']); $scanner->setWebRoot(FSC::$app['config']['content_directory']);
//优先从缓存读取数据 //优先从缓存读取数据
$cacheKey = 'allFilesTree'; $prefix = FSC::$app['config']['theme'];
$cacheKey = "{$prefix}_allFilesTree";
$cachedData = Common::getCacheFromFile($cacheKey); $cachedData = Common::getCacheFromFile($cacheKey);
if (!empty($cachedData)) { if (!empty($cachedData)) {
$dirTree = $cachedData; $dirTree = $cachedData;
@ -30,7 +31,7 @@ Class ListController extends Controller {
} }
//优先从缓存读取数据 //优先从缓存读取数据
$cacheKey = 'allFilesData'; $cacheKey = "{$prefix}_allFilesData";
$cachedData = Common::getCacheFromFile($cacheKey); $cachedData = Common::getCacheFromFile($cacheKey);
if (!empty($cachedData)) { if (!empty($cachedData)) {
$scanResults = $cachedData; $scanResults = $cachedData;

5
themes/beauty/controller/SiteController.php

@ -19,7 +19,8 @@ Class SiteController extends Controller {
$scanner->setWebRoot(FSC::$app['config']['content_directory']); $scanner->setWebRoot(FSC::$app['config']['content_directory']);
//优先从缓存读取数据 //优先从缓存读取数据
$cacheKey = 'allFilesTree'; $prefix = FSC::$app['config']['theme'];
$cacheKey = "{$prefix}_allFilesTree";
$cachedData = Common::getCacheFromFile($cacheKey); $cachedData = Common::getCacheFromFile($cacheKey);
if (!empty($cachedData)) { if (!empty($cachedData)) {
$dirTree = $cachedData; $dirTree = $cachedData;
@ -30,7 +31,7 @@ Class SiteController extends Controller {
} }
//优先从缓存读取数据 //优先从缓存读取数据
$cacheKey = 'allFilesData'; $cacheKey = "{$prefix}_allFilesData";
$cachedData = Common::getCacheFromFile($cacheKey); $cachedData = Common::getCacheFromFile($cacheKey);
if (!empty($cachedData)) { if (!empty($cachedData)) {
$scanResults = $cachedData; $scanResults = $cachedData;

3
themes/tajian/controller/FrontapiController.php

@ -480,6 +480,9 @@ eof;
$code = 0; $code = 0;
$err = '签名验证不通过!'; $err = '签名验证不通过!';
}else if (!empty($task_result['done'])) { //如果任务成功抓取到数据 }else if (!empty($task_result['done'])) { //如果任务成功抓取到数据
//清空缓存
$this->cleanAllFilesCache();
$video_id = $this->getVideoId($task_result['url']); $video_id = $this->getVideoId($task_result['url']);
$saveUrlRes = $this->saveUrlShortCut($video_id, $task_result['url']); $saveUrlRes = $this->saveUrlShortCut($video_id, $task_result['url']);
$saveDescRes = $this->saveDescriptionFiles($video_id, $task_result); $saveDescRes = $this->saveDescriptionFiles($video_id, $task_result);

Loading…
Cancel
Save