欢迎光临
我们一直在努力

微博项目的key设计

全局相关的key:

表名

global

列名

操作

备注

Global:userid

incr

产生全局的userid

Global:postid

Incr

产生全局的postid

 

 

用户相关的key()

表名

user

Userid

Username

Password

Authsecret

3

Test3

1111111

#U*Q(%_

 

redis,变成以下几个key

Key前缀

user

User:Userid:*

User:userid:*Username

User:userid:*Password

User:userid:*:Authsecret

User:userid:3

User:userid:3:Test3

User:userid:3:1111111

User:userid:3:#U*Q(%_

 

 

微博相关的表设计

表名

post

Postid

Userid

Username

Time

Content

4

2

Lisi

1370987654f

测试内容

 

微博在redis,与表设计对应的key设计

Key前缀

post

Post:Postid:*

Post:postid:*Userid

Post:postid:*:Username

Post:postid:*:Time

Post:postid:*:Content

4

2

Lisi

1370987654f

测试内容

 


关注表: following

Following:$userid –>

 

粉丝表

Follower:$userid —> 

 

推送表:revicepost

 

=================拉模型,改进=====================

 

拉取表

 

 

: 上次我拉取了 A->5,67,三条微博, 下次刷新home.php, >7的微博开始拉取

解决: 拉取时,设定一个lastpull时间点, 下次拉取时,>lastpull的微博

 

: 有很多关注人,如何取?

解决: 循环自己的关注列表,逐个取他们的新微博

 

: 取出来之后放在哪儿?

: pull:$userid的链接里

 

: 如果个人中心,只有前1000

: ltrim,只取前1000

 

 

: 如果我关注 A,B两人, 2人中,各取3条最新信息

,3+3条信息, 从时间上,是交错的, 如何按时间排序?

: 我们发布时, 是发布的hash结构, 不能按时间来排序.

 

解决:  同步时,取微博后,记录本次取的微博的最大id,

下次同步时,只取比最大id更大的微博

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。