redis and mysql cooperation solution
##Apply Redis to read and write data, and use queue processing at the same time The server writes data to mysql regularly. (Recommended Learning: Redis Video Tutorial ) ## At the same time, pay attention to avoid conflicts. When redis starts, go to MySQL to read all the table key values and store in redis, write data to redis When, the redis primary key is automatically incremented and read. If the mysql update fails, the cache needs to be cleared and the redis primary key needs to be synchronized in time.
Option one:
The program writes Redis and MySQL at the same time
Program to write MySQL, use Gearman to call MySQL UDF, and complete writing to Redis
##Option 3:
The program writes MySQL, parses binlog, puts the data into the queue and writes Redis
Option 4:
Program Write Redis, and put the write into MQ and write MySQL
The above is the detailed content of How do redis and mysql generally cooperate?. For more information, please follow other related articles on the PHP Chinese website!