| 11 | private engine: ICache; |
| 12 | |
| 13 | constructor( |
| 14 | private readonly configService: ConfigService, |
| 15 | module: string, |
| 16 | ) { |
| 17 | const cacheConf = configService.get<CacheConf>('CACHE'); |
| 18 | |
| 19 | if (cacheConf?.REDIS?.ENABLED && cacheConf?.REDIS?.URI !== '') { |
| 20 | logger.verbose(`RedisCache initialized for ${module}`); |
| 21 | this.engine = new RedisCache(configService, module); |
| 22 | } else if (cacheConf?.LOCAL?.ENABLED) { |
| 23 | logger.verbose(`LocalCache initialized for ${module}`); |
| 24 | this.engine = new LocalCache(configService, module); |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | public getEngine() { |
| 29 | return this.engine; |