import { Redis } from 'ioredis';
import { env } from './env.js';
let client = null;
export function redis() {
    if (!client) {
        client = new Redis(env.REDIS_URL, { lazyConnect: false, maxRetriesPerRequest: 2 });
    }
    return client;
}
export async function closeRedis() {
    if (client) {
        await client.quit();
        client = null;
    }
}
//# sourceMappingURL=redis.js.map