This calculation process is not a one-time http operation, and it cannot be calculated immediately unless you are a very experienced algorithm engineer and data engineer.
These things are calculated slowly in the background. Otherwise, what do the data mining engineers rely on? When the calculated results are calculated, they will start pushing them to you. At this time, the benefits of using static language and resident memory on the server side can be reflected.
After watching the video, it was clearly stated: pre-calculation. (Watch from 10 minutes and 30 seconds)
Just calculate it when you pay attention (inserting data).
When user 1 logs in, he can get the friend relationship by taking the intersection of user:1:fans and user:1:follow. Then, can he get the intersection by taking the intersection of user:1:follows and user:2:follows? Users you follow in common? I believe I don’t need to explain the rest of the intersection differences, you should know it too
This calculation process is not a one-time http operation, and it cannot be calculated immediately unless you are a very experienced algorithm engineer and data engineer.
These things are calculated slowly in the background. Otherwise, what do the data mining engineers rely on? When the calculated results are calculated, they will start pushing them to you. At this time, the benefits of using static language and resident memory on the server side can be reflected.
After watching the video, it was clearly stated: pre-calculation. (Watch from 10 minutes and 30 seconds)
Just calculate it when you pay attention (inserting data).
It’s easy to use redis sets.
Example:
user:1:fans [2,3,4] //Follow users 1
user:1:follows [2,5,7,8] //User 1 follows
user:2:fans [1,3,4] //Follow users 2
user:2:follows [1,7,8] //User 2 follows
When user 1 logs in, he can get the friend relationship by taking the intersection of user:1:fans and user:1:follow. Then, can he get the intersection by taking the intersection of user:1:follows and user:2:follows? Users you follow in common? I believe I don’t need to explain the rest of the intersection differences, you should know it too