Commit 148961f3 authored by 陈志良's avatar 陈志良

照片墙热门帖子缓存10秒

parent 3363b4d2
...@@ -390,27 +390,37 @@ exports.getThreadById = function(tid, callback) { ...@@ -390,27 +390,37 @@ exports.getThreadById = function(tid, callback) {
// }); // });
// }, // },
// function(cb) { function(cb) {
//获取照片墙最热文章列表 // 获取照片墙最热文章列表
// if (doc.type !== 3) { if (doc.type !== 3) {
// cb(null, null); cb(null, null);
// return; return;
// } }
// var conditions = { var conditions = {
// pid: tid, pid: tid,
// type: 3, type: 3,
// status:1, status:1,
// images: {$exists: true, $not: {$size: 0}} images: {$exists: true, $not: {$size: 0}}
// }; };
// getAllThreadByFidHelp(conditions, 1, 10, '-praise_count', function(err, threads) { var key = 'pisns-forum-thread:' + tid + ':subThreads';
// if (err) {
// console.error(err); redis.get(key,function(err,value){
// cb(err, null); if (value) {
// } else { cb(null, JSON.parse(value));
// cb(null, threads); } else {
// } getAllThreadByFidHelp(conditions, 1, 10, '-praise_count', function(err, threads) {
// }); if (err) {
// }, console.error(err);
cb(err, null);
} else {
redis.set(key, JSON.stringify(threads));
redis.expire(key, 10);
cb(null, threads);
}
});
}
});
},
function(cb) { function(cb) {
//获取发帖人数 //获取发帖人数
var key = 'pisns-forum-thread:' + tid + ':amount'; var key = 'pisns-forum-thread:' + tid + ':amount';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment