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

Add support for node-redis v4.0.0 and newer #8425

Merged
merged 1 commit into from Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/caching.md
Expand Up @@ -149,8 +149,7 @@ 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.

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:

Expand Down
10 changes: 6 additions & 4 deletions src/cache/RedisQueryResultCache.ts
Expand Up @@ -50,10 +50,12 @@ export class RedisQueryResultCache implements QueryResultCache {
async connect(): Promise<void> {
const cacheOptions: any = this.connection.options.cache;
if (this.clientType === "redis") {
if (cacheOptions && cacheOptions.options) {
this.client = this.redis.createClient(cacheOptions.options);
} else {
this.client = this.redis.createClient();
this.client = this.redis.createClient({
...cacheOptions?.options,
legacyMode: true
});
if ("connect" in this.client) {
await this.client.connect();
}
} else if (this.clientType === "ioredis") {
if (cacheOptions && cacheOptions.port) {
Expand Down