import { CACHE_MANAGER } from '@nestjs/cache-manager'; import { Inject, Injectable } from '@nestjs/common'; import { Cache } from 'cache-manager'; @Injectable() export class CacheService { constructor(@Inject(CACHE_MANAGER) private cache: Cache) {} get(key: string) { return this.cache.get(key); } set(key: string, value: any, ttl?: number) { return this.cache.set(key, value, ttl); } }