|
|
|
@ -298,6 +298,29 @@ eof;
@@ -298,6 +298,29 @@ eof;
|
|
|
|
|
return Common::setCache($cacheKey, $cacheData); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//按年、月保存文件数据缓存,以便前端展示 |
|
|
|
|
protected function saveAllFilesGroupedByDate($dateIndexes) { |
|
|
|
|
$cacheKey = $this->allFilesCacheKey; |
|
|
|
|
$cacheData = Common::getCache($cacheKey); |
|
|
|
|
if (empty($cacheData)) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$dateCacheKey = $this->dateIndexCacheKey; |
|
|
|
|
$cacheDir = 'index'; |
|
|
|
|
foreach($dateIndexes as $year => $fileIdsInMonth) { |
|
|
|
|
$tmpData = []; |
|
|
|
|
foreach($fileIdsInMonth as $month => $ids) { |
|
|
|
|
$tmpData[$month] = []; |
|
|
|
|
foreach($ids as $id) { |
|
|
|
|
$tmpData[$month][$id] = $cacheData[$id]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Common::saveCacheToFile("{$dateCacheKey}_{$year}", $tmpData, $cacheDir); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected function saveDateIndexIntoCacheFile() { |
|
|
|
|
$cacheKey = $this->dateIndexCacheKey; |
|
|
|
|
$cacheData = Common::getCache($cacheKey); |
|
|
|
@ -314,6 +337,9 @@ eof;
@@ -314,6 +337,9 @@ eof;
|
|
|
|
|
} |
|
|
|
|
Common::saveCacheToFile("{$cacheKey}_keys", $indexKeys, $cacheDir); |
|
|
|
|
|
|
|
|
|
//按年、月保存文件数据缓存,以便前端展示 |
|
|
|
|
$this->saveAllFilesGroupedByDate($cacheData); |
|
|
|
|
|
|
|
|
|
return Common::saveCacheToFile($cacheKey, $cacheData, $cacheDir); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|