Simple Caching. #3

Open
wants to merge 1 commit into
from

Conversation

Projects
None yet
1 participant

Added simple caching or parsed htmls. Currently it is very simple. There is not code to expire old caches.

Please do test before pull.

@applegrew applegrew commented on the diff Apr 13, 2011

lib/express-jsdom.js
@@ -130,7 +130,9 @@ function insertDocument(doc, req, path) {
if (!root) {
var html = fs.readFileSync(path, 'utf8'),
newDoc = createNewDocument(path, html);
- //root = cache[key] = doc.documentElement;
+ cache[path] =
+ root = newDoc.documentElement;
+ assert.notEqual(root, null, 'doumentElement returned null for ' + path);
@applegrew

applegrew Apr 13, 2011

Added this assert to catch it as it happens. Better to catch it here rather than let it grow into something more complicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment