I am planning to implement a caching system for my site that receives decent traffic. Sometimes MySQL server is overloaded that's why I'm caching MySQL results in static (cached) files. Here is what I do:
- First of all, I check for cache file (page specific)
- If it doesn't exist, I query database and I serialize the results
- I write results to the cache file
- When file exists, I get content with
file_get_contents()
function and unserialize the data
Now my question is, will my caching strategy improve performance or should I keep using database queries for every request?