有没有办法从 nestjs-redis 客户端获取 ioredis 实例?

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

我使用的 Nestjs Redis component and that component use ioredis Node Redis client library. What happens is that I want to save geoinformation through GEOADD 命令在 Redis 上可用,在 ioredis 中也可用。

那么,如何从 Nestjs-Redis 组件获取 ioredis 实例呢?可能吗?

提前致谢!

RedisService 实例上有一个 getClient() 方法,它应该可以满足您的需要。它 returns ioredis Redis 实例。请看一下here.

因此,您必须将 RedisService 注入您的服务并在创建的实例上调用 getClient() 方法(此外,此方法接受连接名称,以防您想要获取特定的 Redis连接)。

我只是好奇,你是不是故意使用原始版本的分叉版本 nestjs-redis package