Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redisInstance is not used #334

Closed
2 of 4 tasks
saurabh-vt opened this issue Mar 8, 2024 · 1 comment
Closed
2 of 4 tasks

redisInstance is not used #334

saurabh-vt opened this issue Mar 8, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@saurabh-vt
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

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?

  • macOS
  • Windows
  • Linux

Other

No response

@saurabh-vt saurabh-vt added the bug Something isn't working label Mar 8, 2024
@kamilmysliwiec
Copy link
Member

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.

@nestjs nestjs locked and limited conversation to collaborators Mar 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants