Interview question How to ensure double write consistency between the cache and the database? Interviewer psychoanalysis You only need to use the cache, it may involve double storage and double storage of the database. As long as you double write, there will be data consistency problems. How do you solve the consistency problem? Analysis of interview questions In general, if you allow the cache to be slightly inconsistent with the database, that is, if your system is not strictly required to "cache + database" must be consistent, it is best not to do this, namely: read request Serialize the write request and string it into a memory queue . Serialization guarantees that there will be no inconsistencies, but it will also result in a significant reduction in system throughput, supporting a request on the line with machines that are several times larger than normal. Cache Aside Pattern The most classic cache + database read and write mode...
Interview question How is the cache used in the project? Why use a cache? What are the consequences of improper use of the cache? Interviewer psychoanalysis This problem, Internet companies must ask, if a person is not even clear about the cache, it is rather embarrassing. As long as you ask the cache, the first question is, first of all, ask you where to use the cache? Why use it? Don't you have to work? What are the possible consequences if used later? This is to see if you have any thoughts on the back of the cache. If you are stupid and can't give the interviewer a reasonable answer, then the interviewer will not be very good at you. I think you usually think too little. I know how to work. Analysis of interview questions How is the cache used in the project? This, you need to combine the business of your own project. Why use a cache? With caching, there are two main uses: high performance , high concurrency ...