Hi all,
I use a HTML menu that is created from multiple database queries. This is powerfull
and very extendable.
The problem is that the queries have to be executed on every new page or request.
Moreover, the menu won't change very often for the users.
So I would like to 'cache' the HTML code
]
Cc: [EMAIL PROTECTED]
Subject: [PHP] Cacheing data form PHP script
Hi all,
I use a HTML menu that is created from multiple database
queries. This is powerfull and very extendable.
The problem is that the queries have to be executed on every
new page or request.
Moreover, the menu
$_SESSION sounds like a good way to go.. It just means that each user
will pull the data for the menu at least once.
I've done something similar except it was a rather slow database query,
followed by a bunch of conditional data parsing. The end result wasn't
very much data (maybe a page's
Unfortunately not even SQL_CACHE works in this scenario, with 5 or more
generated menus, its a noticable difference in load time.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
It's not really that bad, maybe I just made it sound complicated and
annoying.
(pseudo-php)
If (dataexistsindb) {
$cachedata = SELECT cachedata from DB
$dataarr = unserialize(cachedata)
} else {
$dataarr = SELECT freshdata
$cachedata = serialize($dataarr)
INSERT or UPDATE
It's not really that bad, maybe I just made it sound complicated and
annoying.
(pseudo-php)
If (dataexistsindb) {
$cachedata = SELECT cachedata from DB
$dataarr = unserialize(cachedata)
} else {
$dataarr = SELECT freshdata
$cachedata = serialize($dataarr)
INSERT or
I havent tested this yet, it seems it may be more harmful than good ?
if ($cache_data) {
$query = $db-query(SELECT cache_data FROM
cache_menu_table WHERE table='foo');
if ($db-results()) {
$query = SELECT cache_data
The code works, and seems to run pretty fast, another question would
storing in xml be a better option ?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Here is my final layout, i still yet to test it on the production machine
being a dual 2G xeon, has had major performance issues generated list menus
onto the screen and load time.
function asset_type_list2($tID=null,$tab_index = null,$cache_data =
null,$disabled = null) {
global
Here are some test results using a microtime function i setup
Using database
0.77256107330322 seconds
Using cache
0.23316502571106 seconds
My next problemo is, i have built a Date and Calender class to build the
date and time pulldown's. Although it seems really slow, i have to tweak it
10 matches
Mail list logo