From 6d9adac6e466e8476c8e4442dee7ef8731b6d355 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 26 Nov 2015 23:34:55 -0500 Subject: [PATCH] fixed LRU cache problem --- src/posts/parse.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/posts/parse.js b/src/posts/parse.js index d2c96f6494..4317f024b3 100644 --- a/src/posts/parse.js +++ b/src/posts/parse.js @@ -9,9 +9,8 @@ module.exports = function(Posts) { Posts.parsePost = function(postData, callback) { postData.content = postData.content || ''; - var cachedContent = cache.get(postData.pid); - if (cachedContent) { - postData.content = cachedContent; + if (postData.pid && cache.has(postData.pid)) { + postData.content = cache.get(postData.pid); return callback(null, postData); }