优化体验,新增多项功能,美化界面

This commit is contained in:
eafonyang
2026-06-10 15:37:20 +08:00
parent bb1c851e39
commit 25a45c7cbd
18 changed files with 1213 additions and 302 deletions
+31
View File
@@ -0,0 +1,31 @@
const Redis = require('ioredis');
const logger = require('./logger');
const REDIS_HOST = process.env.REDIS_HOST || '127.0.0.1';
const REDIS_PORT = parseInt(process.env.REDIS_PORT || '6379', 10);
const REDIS_PASSWORD = process.env.REDIS_PASSWORD || '';
const REDIS_EQ_DB = parseInt(process.env.REDIS_EQ_DB || '1', 10);
let eqCacheClient = null;
function getEqCacheRedis() {
if (!eqCacheClient) {
const options = {
host: REDIS_HOST,
port: REDIS_PORT,
db: REDIS_EQ_DB,
maxRetriesPerRequest: 2,
connectTimeout: 10000,
};
if (REDIS_PASSWORD) {
options.password = REDIS_PASSWORD;
}
eqCacheClient = new Redis(options);
eqCacheClient.on('error', (err) => {
logger.error(`Redis EQ cache error: ${err.message}`);
});
}
return eqCacheClient;
}
module.exports = { getEqCacheRedis };