Commit 9c9a29b3 authored by 陈志良's avatar 陈志良

缓存添加JSON转换

parent ea0674fe
......@@ -2391,7 +2391,7 @@ router.get('/thread/:tid/get/subThreads/:type', function(req, res, next) {
var key = 'pisns-forum-thread:' +ent_code+':'+ tid + ':subThreads:type='+type+'&pageNo='+pageNo+'&pageSize='+pageSize;
redis.get(key,function(err,value){
if (value) {
res.json(_.assign(value, returnCode.SUCCESS));
res.json(_.assign(JSON.parse(value), returnCode.SUCCESS));
} else {
async.waterfall([
function(callback) {
......@@ -2443,7 +2443,7 @@ router.get('/thread/:tid/get/subThreads/:type', function(req, res, next) {
var handleThreadListBegin = new Date();
handleThreadList(req, results, ent_code, function(result){
console.log("查询用户对帖子点赞耗时:"+Math.abs(new Date() - handleThreadListBegin));
redis.set(key, result);
redis.set(key, JSON.stringify(result));
redis.expire(key, 5);
res.json(_.assign(result, returnCode.SUCCESS));
});
......
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