import Redis from 'ioredis' const clients = new Map() export class RedisClientDriver extends Redis { constructor ( /** * redis 客户端名字 */ private readonly _name:string, host:string, port:number, password:string, db:number ) { super(port,host,{ password, db }) clients.set(this.name,this) } static getClient (name:string):RedisClientDriver|null { return clients.get(name) || null } get name ():string { return this._name } }