When the client connects to the server, the client can send a command request to the server.
To send a command request from the client to the command to be processed by the server and return the result to the client, the process has the following steps:
1. The client transmits the command protocol data to the server through a socket.
2. The server processes the incoming data through a read event and saves the data in the client's query cache for the redisclient structure.
3. Based on the contents of the client query cache, the program looks for the implementation function of the corresponding command from the command table.
4. The program executes the command implementation function, modifies the server's global state server variable, and saves the execution result of the command to the client redisclient structure's reply cache, and then writes the event for the client's FD association.
5. When the write event of the client FD is ready, the result of the command in the reply cache is passed back to the client. This completes the command execution.