We've been working on a similar piece of software with Momo recently. Because the database has not been keeping up with the situation, so have to add cache. But there is a doubt here.
For a general app, what everyone sees is the same, so it's good to put that data directly into the cache. But for example, Mo mo. People nearby are not the same people that everyone sees nearby. Each person sees different data, how do I load the cache? Or do you have a different, as long as the user wants to see, the data loaded into the cache it? In general, people like Momo, if you are to design a caching strategy, how do you design?????????
Reply content:
We've been working on a similar piece of software with Momo recently. Because the database has not been keeping up with the situation, so have to add cache. But there is a doubt here.
For a general app, what everyone sees is the same, so it's good to put that data directly into the cache. But for example, Mo mo. People nearby are not the same people that everyone sees nearby. Each person sees different data, how do I load the cache? Or do you have a different, as long as the user wants to see, the data loaded into the cache it? In general, people like Momo, if you are to design a caching strategy, how do you design?????????
Let's talk about what you understand as "caching".
If you think caching is a magical thing that can speed up the program, then I have to give you a wake-up call, the "magic" is a cost, and you don't necessarily pay.
In general, when you decide to use the cache, there are a few points that you must consider first.
1) data is not sensitive to timeliness.
2) The performance bottleneck lies in the IO of the database
3) intermediate data, not final data
Strictly speaking, the people in the vicinity are not sensitive to timeliness. And the data should be in the middle data, not in the end should be in the storage. Even if there is a certain loss, or the display is empty, it should be acceptable, right?
You can simply drop the cache without considering the cost. But for the cache utilization, as well as the hit rate situation, it is necessary to see the actual invocation situation.
If a person near you, the amount of clicks itself is very small, it is possible not to do the cache.
The cache design can also be considered for your specific business situation.