Permalink
Browse files

refactor cache() helper

  • Loading branch information...
1 parent 7d28ae1 commit 64093dca041966d9dcd4128c0dc779303a2b9cfd @tj committed Dec 22, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/consolidate.js
View
@@ -58,12 +58,18 @@ exports.clearCache = function(){
*/
function cache(options, compiled) {
+ // cachable
if (compiled && options.filename && options.cache) {
delete readCache[options.filename];
cacheStore[options.filename] = compiled;
- } else if (options.filename && options.cache) {
+ return compiled;
+ }
+
+ // check cache
+ if (options.filename && options.cache) {
return cacheStore[options.filename];
}
+
return compiled;
}

0 comments on commit 64093dc

Please sign in to comment.