Skip to content
Myr

Fixed caching of views when using several apps. Closes #637

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

simple fix :)

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent bc68e5e · Browse files · 2 files+4 added−9 removed
This commit

State

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

Diff stats

2 files+4 added−9 removed

  • other:+4 added−9 removed

2 files+4 added−9 removed

modified:lib/http.js+1 added
42 unmodified lines
43 */4445Server.prototype.init = function(middleware){46 var self = this;47 this.cache = {};48 this.match = {};49 this.lookup = {};50 this.settings = {};51 this.redirects = {};
427 unmodified lines
modified:lib/view.js+3 added-9 removed
20 unmodified lines
21 , http = require('http')22 , res = http.ServerResponse.prototype;2324/**25 * Memory cache.26 */2728var cache = {};2930/**25 * Expose constructors.26 */2728exports = module.exports = View;
293 unmodified lines
322 return renderPartial(self, path, opts, options, view);323 };324325 // cached view332 if (cache[view]) {333 view = cache[view];326 if (app.cache[view]) {327 view = app.cache[view];328 options.filename = view.path;329 // resolve view330 } else {331 var orig = view = new View(view, options);
27 unmodified lines
359360 options.filename = view.path;361 var engine = view.templateEngine;362 view.fn = engine.compile(view.contents, options)369 if (cacheViews) cache[orig.view] = view;363 if (cacheViews) app.cache[orig.view] = view;364 }365366 // layout helper367 options.layout = function(path){
42 unmodified lines