Skip to content

Commit 213ad68

Browse files
authored
fix: missing ttl in performance cache (#1863)
1 parent 665c520 commit 213ad68

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

apps/nestjs-backend/src/features/aggregation/open-api/aggregation-open-api.controller.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,15 @@ export class AggregationOpenApiController {
6868
table.lastModifiedTime?.getTime().toString() ?? '0',
6969
cacheQuery
7070
);
71-
return this.performanceCacheService.wrap(cacheKey, () => {
72-
return fn();
73-
});
71+
return this.performanceCacheService.wrap(
72+
cacheKey,
73+
() => {
74+
return fn();
75+
},
76+
{
77+
ttl: 60 * 60, // 1 hour
78+
}
79+
);
7480
}
7581

7682
@Get()

apps/nestjs-backend/src/features/record/open-api/record-open-api.controller.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,15 @@ export class RecordOpenApiController {
228228
table.lastModifiedTime?.getTime().toString() ?? '0',
229229
cacheQuery
230230
);
231-
return this.performanceCacheService.wrap(cacheKey, () => {
232-
return this.recordService.getDocIdsByQuery(tableId, cacheQuery);
233-
});
231+
return this.performanceCacheService.wrap(
232+
cacheKey,
233+
() => {
234+
return this.recordService.getDocIdsByQuery(tableId, cacheQuery);
235+
},
236+
{
237+
ttl: 60 * 60, // 1 hour
238+
}
239+
);
234240
}
235241

236242
@Permissions('table|read')

0 commit comments

Comments
 (0)