1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| import { Inject, Injectable, Logger } from '@nestjs/common' import { CACHE_MANAGER } from '@nestjs/cache-manager' import { Cache } from 'cache-manager'
@Injectable() export class FileCacheService { private readonly logger = new Logger(FileCacheService.name)
constructor(@Inject(CACHE_MANAGER) private fileCache: Cache) {}
async get(cacheKey: string) { return this.fileCache.get(cacheKey) } async set(key: string, value: any, cacheTime?: number) { await this.fileCache.set(key, value, cacheTime) } }
|