1111
This commit is contained in:
parent
6acb40da3c
commit
bf6cebe31a
7
index.js
7
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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user