Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/ExpressRedisCache/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ module.exports = (function () {
/** If has wildcard */
if ( hasWildcard ) {
/** Get a list of keys using the wildcard */
self.client.keys(prefix + ':' + name, domain.intercept(function (keys) {
if ( ! keys.length ) {
self.client.scan(0, 'match', prefix + ':' + name, domain.intercept(function (result) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are going to perform only one SCAN iteration which could return empty results set, so to find all matching keys you will need to repeat scanning till the end.

if ( typeof result[1] === 'undefined' ) {
callback(null, []);
return domain.exit();
}

require('async').parallel(keys.map(function (key) {
require('async').parallel(result[1].map(function (key) {
return function (cb) {
return fetchKey(key, cb);
};
Expand Down