设为首页 加入收藏

TOP

redis时间排序,内容显示
2014-11-23 23:18:36 来源: 作者: 【 】 浏览:7
Tags:redis 时间 排序 内容 显示
redis时间排序,内容显示
global.redisRelation.set("msg_time:1:time","2032-5-3 06:26:08");
global.redisRelation.set("msg_time:2:time","2002-5-3 14:26:08");
global.redisRelation.set("msg_time:3:time","2030-5-3 03:26:08");
global.redisRelation.set("msg_time:4:time","2030-5-3 03:26:07");
global.redisRelation.set("msgcontent:1",JSON.stringify({content:"44"}));
global.redisRelation.set("msgcontent:2",JSON.stringify({content:"bb"}));
global.redisRelation.set("msgcontent:3",JSON.stringify({content:"aa"}));
global.redisRelation.set("msgcontent:4",JSON.stringify({content:"55"}));
global.redisRelation.sort("msg","by","msg_time:*:time","desc",
"alpha","get","msgcontent:*","store","tmp");
global.redisRelation.lrange("tmp",0,-1,function(err,values){
console.log("fuck");
for(var i=0;i
{
var obj=JSON.parse(values[i]);
console.log(obj.content);
}
});
根据msg_time:*:time的时间对msgcontent:*中的内容取出,放入tmp中

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇如何诊断过去某个时间段的等待事.. 下一篇当数据积累到一定时间后执行会越..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: