swagger configurado na rota chavenfe

This commit is contained in:
unknown
2025-03-29 15:06:21 -03:00
parent 5e4ef04b4a
commit 32bd7c14b3
29 changed files with 709 additions and 241 deletions

15
src/shared/cache.util.ts Normal file
View File

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