Skip to content

Commit

Permalink
feat: add support for specifying ioredis cache with a URL (#7689)
Browse files Browse the repository at this point in the history
According to the ioredis documentation, a URL may be passed in the 'port' parameter.
    This does not currently work when using an ioredis cache. Modify ioredis connection logic
    to conform to ioredis standards.

    Closes: #7631

Co-authored-by: Joe Caputo <joseph.caputo@atomyze.us>
  • Loading branch information
JoeCap08055 and Joe Caputo committed May 29, 2021
1 parent 0f7a778 commit e017f9b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/cache/RedisQueryResultCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ export class RedisQueryResultCache implements QueryResultCache {
this.client = this.redis.createClient();
}
} else if (this.clientType === "ioredis") {
if (cacheOptions && cacheOptions.options) {
if (cacheOptions && cacheOptions.port) {
if (cacheOptions.options) {
this.client = new this.redis( cacheOptions.port, cacheOptions.options );
} else {
this.client = new this.redis( cacheOptions.port );
}
}
else if (cacheOptions && cacheOptions.options) {
this.client = new this.redis(cacheOptions.options);
} else {
this.client = new this.redis();
Expand Down

0 comments on commit e017f9b

Please sign in to comment.