Skip to content

Commit c28f92e

Browse files
sample: simulate timeout to demonstrate caching
1 parent 198eaf7 commit c28f92e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sample/20-cache/src/app.controller.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import { Controller, Get, UseInterceptors } from '@nestjs/common';
55
@UseInterceptors(CacheInterceptor)
66
export class AppController {
77
@Get()
8-
findAll() {
8+
async findAll() {
9+
// For demonstration purposes, we will simulate a delay
10+
// to show that the cache is working as expected.
11+
await new Promise(resolve => setTimeout(resolve, 3000));
912
return [{ id: 1, name: 'Nest' }];
1013
}
1114
}

0 commit comments

Comments
 (0)