Browse Source

Use call instead of apply for cached results.

feature/nested-cache-fetch-fix
Elliott Foster 10 years ago
parent
commit
e0c011dfcf
  1. 5
      lib/caching.js

5
lib/caching.js

@ -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);
}

Loading…
Cancel
Save