I am using Flask
app. Here is an api that selects data from mysql and return data to client.
In every request, I connect mysql.
cnx = mysql.connector.connect(user='xx', password='xx',
host='xx',
database='xx')
In my opinion, the connection takes time. So how can I use this cache? Because it seems unnecessary to connect mysql database every time.