Is there a way to get ioredis instance from nestjs-redis client?

Viewed 1681

I'm using the Nestjs Redis component and that component use ioredis Node Redis client library. What happens is that I want to save geoinformation through GEOADD command available on Redis and available also in the ioredis.

So, how can I get an ioredis instance from Nestjs-Redis component? Is it possible?

Thanks in advance!

1 Answers

There is a getClient() method on the RedisService instance, that is supposed to do exactly what you need. It returns ioredis Redis instance. Please, take a look at it here.

So, you have to inject RedisService into your service and call the getClient() method on the created instance (also, this method accepts a connection name in case you want to get a specific Redis connection).

I'm just curiuos about, do you intentionally use a forked version of the original nestjs-redis package?

Related