cache-manager icon indicating copy to clipboard operation
cache-manager copied to clipboard

Existing multicaching support not exposed in types

Open adworacz opened this issue 2 years ago • 4 comments
trafficstars

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

adworacz avatar Sep 28 '23 22:09 adworacz

Would you like to create a PR for this issue?

kamilmysliwiec avatar Sep 29 '23 07:09 kamilmysliwiec

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.

adworacz avatar Oct 02 '23 23:10 adworacz

hello there 👋🏻 let you know more situation about this problem. if i can understand that. i want to try :)

Djunnni avatar Oct 25 '23 08:10 Djunnni

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.

honguyenhaituan avatar Feb 25 '24 02:02 honguyenhaituan

Example https://github.com/nestjs/cache-manager/blob/2a82f89c79aeb0473ef50b74d530d2988a9c22b4/tests/src/multi-store/multi-store.module.ts#L8-L21

kamilmysliwiec avatar Oct 18 '24 12:10 kamilmysliwiec