Query or Cache
Posted: Wed Jun 22, 2005 10:49 am
Ok, suppose that you have a large script. You have serveral functions that access the database and the overall memory usage of the script is getting rather large. Currently those functions cache their data so that if the function is called again in the same page load it will load the data from the cache instead of re-quering the database. When the function is first called, it collects all the data it needs to answer any feasible, valid call to it, generating rather large caches. Is it worth it? Would it be better just to re-query the database instead of building up a huge cache of information probably never to be used?
If it is worth it, should this information be, instead of being lost at the termination of the script, cached even further to the effect that it will last several page loads? If so, what do you think would be a good exipiry timeout?
If it is worth it, should this information be, instead of being lost at the termination of the script, cached even further to the effect that it will last several page loads? If so, what do you think would be a good exipiry timeout?