I have a main page in HTML which makes some Ajax calls (about 10) to a PHP file.
The PHP gets some data from different websites (via file_get_contents) and outputs it as JSON. The average length of the output is 4000 characters. To not overload the number of request that my server makes to the websites, I would like to cache the response of same queries for something like 30-60 minutes.
The HTML main page contains a search input, so basically anything can be written and I may need to have a lot of different cache files. In this case, which method is more efficient, database storing (MySQL) or file?