optimize: xác nhận redis đã nén dữ liệu

This commit is contained in:
2026-06-16 20:22:53 +07:00
parent 37b5d14d7e
commit 1709638bfd
3 changed files with 3 additions and 1 deletions
@@ -74,6 +74,7 @@ export class CompressCacheInterceptor implements NestInterceptor {
try {
const compressed = await gzip(Buffer.from(jsonString, 'utf8'));
await this.cacheManager.set(cacheKey, compressed, ttl);
console.log(`[Cache] 📦 Đã nén dữ liệu cho: ${cacheKey} (${jsonString.length} -> ${compressed.length} bytes)`);
// Không setHeader ở đây vì response có thể đã gửi xong
} catch (e) {
console.error(`[Cache] Lỗi nén dữ liệu cho key ${cacheKey}:`, e);