/
githubmirror
/
nest
Обзор
Документация
Войти
/
githubmirror
/
nest
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
sample/20-cache/src/app.controller.ts
14 строк
452 B
Kamil Myśliwiec
sample: simulate timeout to demonstrate caching
21 окт 2024, 10:40
Не верифицирован
21 окт 2024, 10:40
c28f92e
Код
Авторство
О чём код?
import { CacheInterceptor } from '@nestjs/cache-manager'; import { Controller, Get, UseInterceptors } from '@nestjs/common'; @Controller() @UseInterceptors(CacheInterceptor) export class AppController { @Get() async findAll() { // For demonstration purposes, we will simulate a delay // to show that the cache is working as expected. await new Promise(resolve => setTimeout(resolve, 3000)); return [{ id: 1, name: 'Nest' }]; } }