1. Using c++language, vs2019 develops cross platform [Windows and Linux] to connect MySql and Redis frameworks.
2. Use MySql to persist player data, Redis as the player data cache layer, and Redis does not persist data.
MySQL works very efficiently with Redis, just like men and women are not tired of working together. Without Redis, MySQL can be independent
Good completion of user read/write requests. With Redis, users can access data more efficiently, in less time, and quickly
Request.
3. Explain how to maintain the strong consistency strategy of MySQL and Redis data and implement it in code. Every time you start Redis, you can use the pipeline technology from MySQL
Batch import active user data into Redis and set the expiration time
4. The tutorial uses thread pool technology. Each thread has its own independent data and thread binding classes. Each instance contains a thread
The data of each thread includes: mysql connector, Redis connector, memory recycling pool, secure serial queue, condition variable, and mutex
Ensure data security within threads.
5. Operating principle:
When there is no request, each worker thread is in the sleep state.
When there are read-write requests, obtain a thread from the thread pool, add read-write requests, and push the data to the thread work queue.
Then the worker thread obtains the data of the queue, arranges the serial work tasks, reads and writes MySQL databases, and reads and writes Redis data,
When the work task is completed, the next work task is executed, and the processing result is pushed to the logical thread to send the data to the user.
6. User read data strategy: users first search data from Redis, and Redis finds the data,
Data is returned to the player. Redis fails to search. Data is searched in MySQL, written to Redis, and returned to the user.
7. User write data strategy: users first delete data from Redis, then write data to MySQL, and finally write data to Redis to maintain data consistency.
8. The tutorial is a dry goods tutorial, not a novice tutorial. The basic syntax of MySQL is rarely explained. Redis has a series of basic explanations.
The tutorial explains how to build a high concurrency, high-performance read-write database framework, and use the high availability, high-performance framework of MySQL+Redis.
If you want to obtain the source code, please contact the online customer and the tutorial author