Closed saurabh-vt closed 7 months ago
Thank you for taking the time to submit your report! From the looks of it, this could be better discussed on our Discord. If you haven't already, please join here and send a new post in the # 🐈 nestjs-help forum. Make sure to include a link to this issue, so you don't need to write it all again. We have a large community of helpful members, who will assist you in getting this to work.
Is there an existing issue for this?
Current behavior
Node cache manager provides the ability to pass redisInstance , this can be utilized to use a existing redis connection for cache https://github.com/dabroek/node-cache-manager-ioredis?tab=readme-ov-file#use-an-external-redis-instance
CacheModule.registerAsync({
imports: [RedisModule],
inject: [RedisService],
useFactory: (redisService: RedisService) => ({
redisInstance: redisService.getClient(),
store: redisStore,
}),
}),
a new connection is opened on using the above code
Minimum reproduction code
https://gist.github.com/saurabh-vt/e027ce57bfa3897d16bcb4888b553ad4
Steps to reproduce
initilaize cache manager with redis store
import { redisStore } from 'cache-manager-ioredis-yet'; import type { RedisOptions } from 'ioredis';
create a redisService and inject its instance in the cache-manager
Expected behavior
cache manager should not open a new connection
Package version
^2.2.1
NestJS version
^10.0.2
Node.js version
v18.18.0
In which operating systems have you tested?
Other
No response