This commit is contained in:
张成
2025-12-19 17:44:29 +08:00
parent a549d39f61
commit 155abf2381
2 changed files with 30 additions and 8 deletions

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];
}
});