Yesterday's article on connection handling and caching techniques spurred a number of comments both on and offline, regarding whether or not the solution I propose is actually a good one. I wanted to follow up with some benchmark results that show the performance difference of caching in files, versus using the MySQL query cache.
A note about lazy loading
Before I go on, however, I did want to point out that Andrew Magrude did have an excellent comment on the previous article, and brought up something I had not thought of regarding the mysql_real_escape_string() function. He correctly states that using the mysql_real_excape_string() function will require a connection to the database, and for folks concerned about SQL injection attacks for various character sets, you will want to ensure that a connection is made to the database before trying to use …
[Read more]