import { CACHE_MANAGER, Inject, Injectable } from '@nestjs/common'; import { Cache } from 'cache-manager'; @Injectable() export class CacheService { constructor( @Inject(CACHE_MANAGER) private readonly cacheManager: Cache, ) {} async get(key: string): Promise { return await this.cacheManager.get(key); } async set(key: string, value: T): Promise { await this.cacheManager.set(key, value); } async delete(key: string) { await this.cacheManager.del(key); } }