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...