diff --git a/lib/adapters/RedisAdapter.ts b/lib/adapters/RedisAdapter.ts index 9fbcf6c4..fc35c285 100644 --- a/lib/adapters/RedisAdapter.ts +++ b/lib/adapters/RedisAdapter.ts @@ -93,6 +93,19 @@ export class RedisAdapter implements CacheClient { } }; + static responseScanCommandCallback = (resolve: Function, reject: Function): Callback => ( + err: any, + response: any, + ) => { + if (err) { + reject(err); + } else { + // array exists at index '1' from SCAN command + resolve(response['1']); + return; + } + }; + // The node_redis client private redisClient: RedisClient; @@ -264,11 +277,11 @@ export class RedisAdapter implements CacheClient { `*${pattern}*`, 'COUNT', '1000', - RedisAdapter.responseCallback(resolve, reject), + RedisAdapter.responseScanCommandCallback(resolve, reject), ); }); } throw new Error('Redis client is not accepting connections.'); } -} +} \ No newline at end of file