Skip to content

Commit

Permalink
Note about ioredis promises
Browse files Browse the repository at this point in the history
  • Loading branch information
althoff0 committed Aug 15, 2024
1 parent abe6500 commit f84acef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ export class RedisCache implements Cache {
this.singleFlightGetCache = new Map();
this.singleFlightApplyCache = new Map();

// Redis@3 & Redis@2 need to be promisified b/c they can't return promises (Redis@4 can)
// Ioredis already returns promises, so it returns the following warning when used
// (node:21449) [DEP0174] DeprecationWarning: Calling promisify on a function that returns a Promise is likely a mistake.
this._get = promisify(redisClient.get).bind(redisClient);
this._psetex = promisify(redisClient.psetex).bind(redisClient);
this._del = promisify(redisClient.del).bind(redisClient);
Expand Down

0 comments on commit f84acef

Please sign in to comment.