11
This commit is contained in:
parent
ae9a73c457
commit
a1d4a5ebc2
@ -161,7 +161,6 @@ const server = http.createServer(async (req, res) => {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// 增加 API 调用次数
|
// 增加 API 调用次数
|
||||||
viewsInfo.apiCall++;
|
viewsInfo.apiCall++;
|
||||||
const apiData = await fetchApiData(reqPath, token, sign);
|
const apiData = await fetchApiData(reqPath, token, sign);
|
||||||
@ -221,7 +220,6 @@ const checkCacheHeaders = async (req, cacheMetaFile) => {
|
|||||||
// 检查缓存是否有效
|
// 检查缓存是否有效
|
||||||
const isCacheValid = (cacheMetaFile, cacheContentFile) => {
|
const isCacheValid = (cacheMetaFile, cacheContentFile) => {
|
||||||
if (!fs.existsSync(cacheMetaFile) || !fs.existsSync(cacheContentFile)) return false;
|
if (!fs.existsSync(cacheMetaFile) || !fs.existsSync(cacheContentFile)) return false;
|
||||||
|
|
||||||
const cacheData = JSON.parse(fs.readFileSync(cacheMetaFile, 'utf8'));
|
const cacheData = JSON.parse(fs.readFileSync(cacheMetaFile, 'utf8'));
|
||||||
return cacheData.expiration > Date.now();
|
return cacheData.expiration > Date.now();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user