import { env } from "$env/dynamic/private";
import { Redis } from "ioredis";
export * from "ioredis";

const url = env.REDIS_URL ?? "";

let redis: Redis | undefined;

export function getRedisInstance() {
	if (redis) {
		return redis;
	}
	redis = new Redis(url);
	return redis;
}
