Skip to content
Myr

re-implemented "view cache"

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent cb2b9fe · Browse files · 1 file+4 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−1 removed

  • other:+4 added−1 removed

1 file+4 added−1 removed

modified:lib/application.js+4 added-1 removed
553 unmodified lines
554555app.render = function(view, options, fn){556 var self = this557 , opts = {}558 , cache = this.cache559 , engines = this.engines;560561 // support callback function as second arg562 if ('function' == typeof options) {
27 unmodified lines
590 var engine = engines[ext] = engines[ext] || require(ext);591 this.lookup(view, function(err, path){592 if (err) return fn(err);593 opts.filename = path;594 view = opts.cache595 ? cache[path] || (cache[path] = fs.readFileSync(path, 'utf8'))593 view = fs.readFileSync(path, 'utf8');596 : fs.readFileSync(path, 'utf8');597 engine.render(view, opts, fn);598 });599 } catch (err) {600 fn(err);
15 unmodified lines