diff --git a/index.js b/index.js index 79a505a..f9cf85e 100644 --- a/index.js +++ b/index.js @@ -19,6 +19,8 @@ const viewsInfo = { cacheHit: 0, // API调用次数 apiCall: 0, + // 缓存调用次数 + cacheCall: 0, }; // 默认端口号和 API 地址 @@ -236,6 +238,11 @@ const fetchAndServe = (data, tempCacheContentFile, cacheContentFile, res) => { // 从缓存中读取数据并返回 const serveFromCache = (cacheMetaFile, cacheContentFile, res) => { + + // 增加缓存调用次数 + viewsInfo.cacheCall++; + + const cacheData = JSON.parse(fs.readFileSync(cacheMetaFile, 'utf8')); const readStream = fs.createReadStream(cacheContentFile);