
const Redis = require("ioredis")
const { getRedisConnectionOptions } = require("./connection")

let sharedClient

function getRedisClient() {
  if (!sharedClient) {
    sharedClient = new Redis(getRedisConnectionOptions())
  }
  return sharedClient
}

module.exports = { getRedisClient }
