Skip to content

Commit

Permalink
feat(cache): inject caching handler
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanebachelier committed Jan 3, 2016
1 parent 319330e commit 3b77567
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ export default function cache (config = {}) {
}

return (req, next, service) => {
return next()
.then(store.cacheFn);
const useCache = !service.use || (service.use && (service.use.cache !== false))
const promise = next()

if (useCache) {
promise.then(store.cache)
}

return promise;
}
}

0 comments on commit 3b77567

Please sign in to comment.