mirror of
https://github.com/woodchen-ink/Random-Api.git
synced 2025-07-19 14:32:04 +08:00
Update app.js
This commit is contained in:
parent
64dec23fb5
commit
4ae023afd7
@ -1,6 +1,6 @@
|
|||||||
import express from 'express';
|
import express from 'express';
|
||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import LRU from 'lru-cache';
|
import { LRUCache } from 'lru-cache'; // 使用命名导入
|
||||||
import compression from 'compression';
|
import compression from 'compression';
|
||||||
import winston from 'winston';
|
import winston from 'winston';
|
||||||
import 'winston-daily-rotate-file';
|
import 'winston-daily-rotate-file';
|
||||||
@ -29,9 +29,10 @@ let csvPathsCache = null;
|
|||||||
let lastFetchTime = 0;
|
let lastFetchTime = 0;
|
||||||
const CACHE_DURATION = 60 * 1000 * 60 * 24; // 24小时
|
const CACHE_DURATION = 60 * 1000 * 60 * 24; // 24小时
|
||||||
|
|
||||||
const csvCache = new LRU({
|
// 使用新的 LRUCache 构造函数
|
||||||
|
const csvCache = new LRUCache({
|
||||||
max: 100, // 最多缓存100个CSV文件
|
max: 100, // 最多缓存100个CSV文件
|
||||||
maxAge: 1000 * 60 * 60 * 24 // 缓存24小时
|
ttl: 1000 * 60 * 60 * 24 // 缓存24小时
|
||||||
});
|
});
|
||||||
|
|
||||||
// 日志名称格式
|
// 日志名称格式
|
||||||
|
Loading…
x
Reference in New Issue
Block a user