|
|
@ -1,5 +1,3 @@ |
|
|
|
/*jshint -W072 */ |
|
|
|
|
|
|
|
var async = require('async'); |
|
|
|
var domain = require('domain'); |
|
|
|
|
|
|
@ -22,8 +20,7 @@ var multi_caching = function (caches) { |
|
|
|
|
|
|
|
var i = 0; |
|
|
|
async.forEachSeries(caches, function(cache, async_cb) { |
|
|
|
if(typeof options === 'object'){ |
|
|
|
cache.store.get(key, options, function (err, result) { |
|
|
|
var callback = function(err, result) { |
|
|
|
if (err) { |
|
|
|
return cb(err); |
|
|
|
} |
|
|
@ -34,22 +31,12 @@ var multi_caching = function (caches) { |
|
|
|
|
|
|
|
i += 1; |
|
|
|
async_cb(err); |
|
|
|
}); |
|
|
|
}; |
|
|
|
if (typeof options === 'object') { |
|
|
|
cache.store.get(key, options, callback); |
|
|
|
}else { |
|
|
|
cache.store.get(key, function (err, result) { |
|
|
|
if (err) { |
|
|
|
return cb(err); |
|
|
|
cache.store.get(key, callback); |
|
|
|
} |
|
|
|
if (result) { |
|
|
|
// break out of async loop.
|
|
|
|
return cb(err, result, i); |
|
|
|
} |
|
|
|
|
|
|
|
i += 1; |
|
|
|
async_cb(err); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
}, cb); |
|
|
|
} |
|
|
|
|
|
|
|