diff --git a/docs/caching.md b/docs/caching.md index 2a193b12903..21ce410e10c 100644 --- a/docs/caching.md +++ b/docs/caching.md @@ -149,8 +149,9 @@ Example: } ``` -"options" can be [node_redis specific options](https://github.com/NodeRedis/node_redis#options-object-properties) or [ioredis specific options](https://github.com/luin/ioredis/blob/master/API.md#new-redisport-host-options) depending on what type you're using. +"options" can be [node_redis specific options](https://github.com/redis/node-redis/blob/master/docs/client-configuration.md) or [ioredis specific options](https://github.com/luin/ioredis/blob/master/API.md#new-redisport-host-options) depending on what type you're using. +If you are using node-redis v4.0.0 or newer, make sure to pass `legacyMode: true` in the "options" for the client to operate correctly. In case you want to connect to a redis-cluster using IORedis's cluster functionality, you can do that as well by doing the following: diff --git a/src/cache/RedisQueryResultCache.ts b/src/cache/RedisQueryResultCache.ts index 8c60e084fc5..61a0d14e353 100644 --- a/src/cache/RedisQueryResultCache.ts +++ b/src/cache/RedisQueryResultCache.ts @@ -55,6 +55,9 @@ export class RedisQueryResultCache implements QueryResultCache { } else { this.client = this.redis.createClient(); } + if ("v4" in this.client) { + await this.client.connect(); + } } else if (this.clientType === "ioredis") { if (cacheOptions && cacheOptions.port) { if (cacheOptions.options) {