1: Optimize the logic 2: Due to time issues, the statistical data may be inaccurate (this is OK if you don’t pay attention to the accuracy of the results) 3: It is not good if the number of users is large (the data is cached if the amount of data is large, and the operation is scheduled again) The database can be used) Only do the statistics for each query, which is simpler. . .
In this case, it is directly cached. Redis is very suitable for counting. It is very useful for this statistical scenario with frequent changes. Even if the cache is lost, it can be reloaded from the database into the cache
Another way is to use views
1: Optimize the logic
2: Due to time issues, the statistical data may be inaccurate (this is OK if you don’t pay attention to the accuracy of the results)
3: It is not good if the number of users is large (the data is cached if the amount of data is large, and the operation is scheduled again) The database can be used)
Only do the statistics for each query, which is simpler. . .
In this case, it is directly cached. Redis is very suitable for counting. It is very useful for this statistical scenario with frequent changes. Even if the cache is lost, it can be reloaded from the database into the cache