Cacheing data form PHP script
| From: | Vincent DUPONT | Date: | Wed, 28 Jan 2004 08:49:13 +0000 |
| Subject: | Cacheing data form PHP script | ||
| Groups: | php.general php.pear.general | ||
| Request: | Send a blank email to php-general+get-176021@lists.php.net to get a copy of this message | ||
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 that is generated. If one admin
add/remove/update one menu, I need to clear the cache.
At the moment, I store the HTML code to display the menu in the
$_SESSION['menu_cache']['menu_id'] var. And this works well! The pages are
displayed faster when the menu is in the cache, which is the expected result!
What is your opinion about this?
Do you see any other way to 'cache' some content?
Could I use the $_ENV variable (or any other) to cache the menus accross ALL visitors/users?
Thank you
Vincent