chore: complete utils modules

This commit is contained in:
mahyargdz
2025-01-19 18:40:51 +03:30
parent a934e5b55e
commit 7347a696d0
9 changed files with 118 additions and 7990 deletions
@@ -0,0 +1,19 @@
import { CACHE_MANAGER, Cache } from "@nestjs/cache-manager";
import { Inject, Injectable } from "@nestjs/common";
@Injectable()
export class CacheService {
constructor(@Inject(CACHE_MANAGER) private cacheManager: Cache) {}
async get<T>(key: string) {
return await this.cacheManager.get<T>(key);
}
async set(key: string, value: string, ttl: number = 120 * 1000) {
await this.cacheManager.set(key, value, ttl);
}
async del(key: string) {
await this.cacheManager.del(key);
}
}