import { IRedisClient } from '../core/configs/cache/IRedisClient'; export async function getOrSetCache( redisClient: IRedisClient, key: string, ttlSeconds: number, fallback: () => Promise ): Promise { const cached = await redisClient.get(key); if (cached) return cached; const data = await fallback(); await redisClient.set(key, data, ttlSeconds); return data; }