Option One
specific description
Only the read operation will update the cache. If the read operation does not hit the cache, go to the database to query, and then write back to the
cache. The
write operation first writes to the database, and then deletes the cache
Existing problems
Redis is over if it cannot be deleted.
Of course, if you invalidate the cache first and then update the library, there is also a problem. Redis will be updated by other threads under multi-threading, causing redis to always be stolen data.
Option II:
specific description
Update redis asynchronously by listening to binlog and mq
Existing problems
Will the master-slave delay cause data loss?
Liam 03/15/2020 10:38 PM
Delay and data loss are two issues
Strong heart 2020/03/15 10:38 pm
I think the Hushan scheme is more reliable, the memory queue is asynchronously serialized
Strong heart 03/03/2020 10:38 PM
This is what caused the data loss
Strong heart 2020/03/15 10:39 pm
Asynchronous synchronous data, there will inevitably be problems with the loss of data lines