I now write my own code for several projects, open redis, take data into variables, open mysqli, insert data into the database, and then add this script to cron.
I feel that there is a lot of repetitive code in it, so I would like to ask the industry if there are some general and efficient excellent frameworks for persistent storage of data in redis to mysql?
1. First of all, even if the framework is selected, what it does is take it out from redis and persist it to mysql. It does not reduce the operation of the data layer, but the framework helps you to do your code inside without writing it. (This is only one advantage).
2. Data Structure and Persistence. The format of Redis storage is mostly K-V, Key is generally the primary key ID, and VALUE is generally Json, but what about mysql, which is a field by field, that is, JSON needs to be converted into javabean and then persisted. Therefore, if your data structure is fixed, you can consider writing a script to process it regularly. If your data is changed, you should control it manually. Otherwise, what is the difference between changing your script and writing 2 lines of code?
Summary: The framework cannot solve the problem of complex data format adaptation between redis and mysql. If only a simple data structure could maintain a timer. Why bother, find a trouble, a bug is not necessarily controllable.