Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Key Design of Weibo Project

2025-03-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Globally relevant key:

table name

global

listing

operation

remarks

Global:userid

incr

Generate global userid

Global:postid

Incr

Generate global postid

user-related key(table)

table name

user

Userid

Username

Password

Authsecret

3

Test3

1111111

#U*Q(%_

In redis, it becomes the following keys

Key prefix

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(%_

Microblog related table design

table name

post

Postid

Userid

Username

Time

Content

4

2

Lisi

1370987654f

test content

In redis, key design corresponding to table design

Key prefix

post

Post:Postid:*

Post:postid:*Userid

Post:postid:*:Username

Post:postid:*:Time

Post:postid:*:Content

4

2

Lisi

1370987654f

test content

Watch list: following

Following:$userid -->

fan list

Follower:$userid --->

push table:revicepost

=====================

pull list

Q: Last time I pulled A->5,67, three tweets, next time refresh home.php, pull from>7 tweets

Solution: When pulling, set a lastpull time point, the next time pull, take>lastpull Weibo

Q: There are a lot of people who care about it, how do you get it?

Solution: Cycle your own follow list and pick up their new tweets one by one

Q: Where do you put it when you take it out?

A: pull:$userid link

Q: If the individual center, only the first 1000

A: ltrim, only take the first 1000

Q: If I follow A and B, I take three updates from each of them.

ah, these 3+3 pieces of information are staggered in terms of time. how can they be sorted by time?

A: When we publish, it's a hash structure, not sorted chronologically.

solution: during synchronization, record the maximum id of the micro blog taken this time after taking the micro blog.

Next time sync, only take tweets larger than max id

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report