|
|
@ -39,7 +39,7 @@ var caching = function (args) { |
|
|
|
if (err && (!self.ignoreCacheErrors)) { |
|
|
|
cb(err); |
|
|
|
} else if (result) { |
|
|
|
cb.apply(null, result); |
|
|
|
cb.call(cb, null, result); |
|
|
|
} else if (self.queues[key]) { |
|
|
|
self.queues[key].push(cb); |
|
|
|
} else { |
|
|
@ -50,7 +50,8 @@ var caching = function (args) { |
|
|
|
if (work_args[0]) { // assume first arg is an error
|
|
|
|
return cb(work_args[0]); |
|
|
|
} |
|
|
|
self.store.set(key, work_args, function (err) { |
|
|
|
// Subsequently assume second arg is result.
|
|
|
|
self.store.set(key, work_args[1], function (err) { |
|
|
|
if (err && (!self.ignoreCacheErrors)) { |
|
|
|
return cb(err); |
|
|
|
} |
|
|
|