import { CACHE_MANAGER , Inject , Injectable } from '@nestjs/common' ; import { Cache } from 'cache-manager' ; @ Injectable ( ) export class RedisCacheService { constructor ( @ Inject ( CACHE_MANAGER ) private readonly cache ) { } async get < T > ( key ) { return await this . cache . get < T > ( key ) ; } async set ( key , value ) { await this . cache . set ( key , value ) ; } async reset ( ) { await this . cache . reset ( ) ; } async del ( key ) { await this . cache . del ( key ) ; } }