nestjs / cache-manager

Cache manager module for Nest framework (node.js) 🗃
MIT License
117 stars 22 forks source link

The register method of CacheModel does not utilize the useClass specified #306

Closed mmuenker closed 6 months ago

mmuenker commented 6 months ago

Is there an existing issue for this?

Current behavior

If the "register" method options include a "useClass" property, the class will not be utilized to determine the cache manager's options.

I am not sure if this is an issue in this repository or in the @nestjs/core repository.

Minimum reproduction code

https://github.com/mmuenker/cache-options-are-not-resolved

Steps to reproduce

  1. yarn
  2. yarn start

Expected behavior

During startup, the CacheModule.register function creates an instance of the CacheModuleOptionsLoader class, which is defined with useClass property.

Package version

2.2.1

NestJS version

10.3.2

Node.js version

18.18.2

In which operating systems have you tested?

Other

$ yarn start
[Nest] 665160  - 02/08/2024, 2:50:23 PM     LOG [NestFactory] Starting Nest application...
[Nest] 665160  - 02/08/2024, 2:50:23 PM     LOG [InstanceLoader] CacheModule dependencies initialized +8ms
[Nest] 665160  - 02/08/2024, 2:50:23 PM     LOG [InstanceLoader] AppModule dependencies initialized +0ms
[Nest] 665160  - 02/08/2024, 2:50:23 PM     LOG [RoutesResolver] AppController {/}: +4ms
[Nest] 665160  - 02/08/2024, 2:50:23 PM     LOG [RouterExplorer] Mapped {/, GET} route +1ms
[Nest] 665160  - 02/08/2024, 2:50:23 PM     LOG [NestApplication] Nest application successfully started +1ms
kamilmysliwiec commented 6 months ago

Use registerAsync not register