Re: PHP+MySQL website cache ? Yes/No
| From: | Martin Zvarík | Date: | Sun, 25 Feb 2007 11:59:02 +0000 |
| Subject: | Re: PHP+MySQL website cache ? Yes/No | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-249393@lists.php.net to get a copy of this message | ||
This benchmark is not very accurate, but you are right the database connection took most of the time.
Shopping cart is stored in session - not in database.
I am half-way doing the eshop I bet it will took much more than 0.01 sec to generate the final version.
I was going to make this file cache system, but I relies that for each page like (?page=News, ?page=Products etc.) these HTML blocks (Navigation, Recommended) changes and that would mean I would have eventually like 50+ cached files.
One way or another I will always need to connect do database (I cannot cache 300 products in 300 files, can I?). So I decided to put the cache in database table - For each URL Name (news/, products/ etc) a Cache (which will be an array of all HTML blocks).
Martin
lists@dwsasia.com napsal(a):
Quoting Martin Zvarík <mzvarik@gmail.com>:I did a benchmark with and without caching to HTML file and it's like: 0.0031 sec (with) and 0.0160 sec (with database) I know these miliseconds don't matter, but it will have significant contribution in high-traffic website, won't it? Martin --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpYes it will. And the 0.0129 seconds extra most of it is maybe to create the DB connection. Or are you using a persistent connection and reuseing it? This benchmark was that together with all other content of the page? I mean including your dynamic shopping cart etc? /Peter --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php