behnamy - 2018-06-05 08:54:24 - In reply to message 2 from Marco Cesarato
Thanks again, useful advise.
One more question, I checked your class codes and saw that every cached data is saving in $__cache variable!
So as it is a variable, not being saved in DB or file, the cache terminates and removes at the end of the script every time that script runs and finishes its work! So there wouldn't be any cache for the next time that script runs again.
Isn't better to save the $__cache data in a temporary DB table with memory engine, or in a File?
in this way the cache would last longer!
Marco Cesarato - 2018-06-05 10:58:44 - In reply to message 3 from behnamy
It depend what you need.
The objective of this class is have query faster and spend less resources.
If you retrieve data from file is slower than retrieve from database.
Another cons is if something is changed on database for example through phpmyadmin some data can be lost if you don't clear the cache.
Maybe i will implement a persistent cache but only if enabled by a flag because not all what a persistent cache of queries.
Thanks for your interest if you have others questions i'm available to respond you.