Skip to content

Node.js based forum software built for the modern web

fixed LRU cache problem

Julian Lambbc42a937ef4
diff --git a/src/posts/parse.js b/src/posts/parse.js
index 4d18f9dd7f..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);
}
@@ -38,4 +37,4 @@ module.exports = function(Posts) {
plugins.fireHook('filter:parse.signature', {userData: userData, uid: uid}, callback);
};
-};
\ No newline at end of file
+};