cache-manager
cache-manager copied to clipboard
Existing multicaching support not exposed in types
Is there an existing issue for this?
- [X] I have searched the existing issues
Current behavior
Technically, the code supports multicaching, as written here: https://github.com/nestjs/cache-manager/blob/master/lib/cache.providers.ts#L53-L59
However, the types set on the register function do not indicate any sort of array input support.
There's also no mention of multicaching support in the documentation
Minimum reproduction code
https://github.com/nestjs/cache-manager/blob/master/lib/cache.providers.ts#L53-L59
Steps to reproduce
No response
Expected behavior
Multicaching should be supported by the register and registerAsync methods.
Package version
2.0.1
NestJS version
10.0.5
Node.js version
No response
In which operating systems have you tested?
- [ ] macOS
- [ ] Windows
- [X] Linux
Other
No response
Would you like to create a PR for this issue?
I'm open to doing so. I'm not sure when I can invest the time just yet, got a few critical projects that need to see completion in the coming month.
hello there 👋🏻 let you know more situation about this problem. if i can understand that. i want to try :)
Hi @Djunnni,
There exists a way to set up multi-caching. I saw it in the test case: https://github.com/nestjs/cache-manager/blob/2a82f89c79aeb0473ef50b74d530d2988a9c22b4/tests/src/multi-store/multi-store.module.ts#L8-L21
But I think it is very hard to read CacheModuleOptions to know there is an existing way config like that.https://github.com/nestjs/cache-manager/blob/2a82f89c79aeb0473ef50b74d530d2988a9c22b4/lib/interfaces/cache-module.interface.ts#L4-L15
So I suggest changing the type of CacheModuleOptions so everyone can easily set up when using the lib.
Example https://github.com/nestjs/cache-manager/blob/2a82f89c79aeb0473ef50b74d530d2988a9c22b4/tests/src/multi-store/multi-store.module.ts#L8-L21