I'm building an online shop & trying to improve performance by minimising MYSQL queries.
Is it good practice to cache the mysql queries via a txt file and then fetch that instead of the query? This is what I'm doing"
Is this more efficient than doing sql queries every time? Any security issues I'm missing?
If you do a benchmark, the costs of doing creating a unique hash and performing IO to disk will be greater than simply fetching from the MySQL server.
IMHO, don't bother going to the extent. Good thoughts, but MySQL already has internal caching and performance tweak.
Focus on building your application, as "premature optimization is the root of all evil".
If you're just starting the application, memcache is a much faster way to go than using text files.
http://memcached.org/
Text files will do the job, and the steps you've outlined make sense, but memcache will be faster and handle a lot of the heavy lifting for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With