sample: simulate timeout to demonstrate caching

This commit is contained in:
Kamil Myśliwiec
2024-10-21 09:40:57 +02:00
parent 198eaf7e5c
commit c28f92e0c3

View File

@@ -5,7 +5,10 @@ import { Controller, Get, UseInterceptors } from '@nestjs/common';
@UseInterceptors(CacheInterceptor)
export class AppController {
@Get()
findAll() {
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' }];
}
}