UNPKG

@mark01/express-utils

Version:

npm package that contains utilities for express.js

24 lines (23 loc) 603 B
import IORedis from 'ioredis'; class Redis { clientInstance; redisHost; redisPassword; redisPort; constructor(redisHost, redisPassword, redisPort) { this.redisHost = redisHost; this.redisPassword = redisPassword; this.redisPort = redisPort; } getClient() { if (!this.clientInstance) { this.clientInstance = new IORedis({ host: this.redisHost, password: this.redisPassword, port: this.redisPort, }); } return this.clientInstance; } } export { Redis };