Complete the code to import CacheModule in a NestJS module.
import { Module, [1] } from '@nestjs/common'; import { CacheModule } from '@nestjs/cache-manager'; @Module({ imports: [CacheModule.register()], }) export class AppModule {}
The Module decorator is imported from @nestjs/common to define a NestJS module.
Complete the code to register CacheModule with a TTL of 5 seconds.
CacheModule.register({ ttl: [1] })The ttl option expects seconds, so 5 means cache expires after 5 seconds.
Fix the error in the CacheModule import statement.
import { CacheModule } from '[1]';
The correct package to import CacheModule from is @nestjs/cache-manager.
Fill both blanks to configure CacheModule with a max cache size of 100 and TTL of 10 seconds.
CacheModule.register({ ttl: [1], max: [2] })TTL is set to 10 seconds and max cache size is set to 100 items.
Fill all three blanks to import CacheModule, register it with TTL 20, and export it from the module.
import { Module, [1] } from '@nestjs/common'; import { CacheModule } from '[2]'; @Module({ imports: [CacheModule.register({ ttl: [3] })], exports: [CacheModule], }) export class CacheConfigModule {}
You import Module decorator, import CacheModule from @nestjs/cache-manager, and set TTL to 20 seconds.