diff --git a/lib/caching.js b/lib/caching.js index cfd203d..087f3d8 100644 --- a/lib/caching.js +++ b/lib/caching.js @@ -19,9 +19,11 @@ module.exports = function Caching(store) { queues[key].push(done); } else { queues[key] = [done]; - work(function(){ + work(function(err){ var args = Array.prototype.slice.call(arguments, 0); - store.set(key, ttl, args); + if (!err) { + store.set(key, ttl, args); + } queues[key].forEach(function(done){ done.apply(null, args); }); @@ -34,4 +36,4 @@ module.exports = function Caching(store) { cacher.store = store; return cacher; -}; \ No newline at end of file +};