This commit is contained in:
张成
2026-03-24 16:07:02 +08:00
commit aa8eaa6ccd
121 changed files with 34042 additions and 0 deletions

22
middleware/redis_proxy.js Normal file
View File

@@ -0,0 +1,22 @@
/**
* Redis 服务代理
* 从 Framework 获取 redisService
*/
const Framework = require("../framework/node-core-framework.js");
module.exports = new Proxy({}, {
get(_, prop) {
const services = Framework.getServices();
const redisService = services?.redisService;
if (!redisService) {
throw new Error('Redis service not available. Framework may not be initialized.');
}
return typeof redisService[prop] === 'function'
? redisService[prop].bind(redisService)
: redisService[prop];
}
});