Hello, i want to know how to cache a dynamic php page. I've tried many caching scripts, but none of them are working. I must be doing something wrong, but i couldn't figure it out.
I need to cache a php file which has a lot of mysql queries(which is causing an overload on the server) every 5-10 minutes, and output it as a html, in a writable directory, for inclusion. Can anyone help to point me in the right direction, or show me a site or blog that explains this in detail?
simple caching script needed
Moderator: General Moderators
-
ViserExcizer
- Forum Newbie
- Posts: 24
- Joined: Tue Nov 25, 2008 1:17 pm
- sergio-pro
- Forum Commoner
- Posts: 88
- Joined: Sat Dec 27, 2008 12:26 pm
Re: simple caching script needed
Hi,
You can use ob_xx functions for that.
see http://ua.php.net/manual/en/function.ob-start.php
before the script call ob_start(),
after script executed (printed html to output): $html = ob_get_contents();
then save $html to a file and call ob_end_flush();
You can use ob_xx functions for that.
see http://ua.php.net/manual/en/function.ob-start.php
before the script call ob_start(),
after script executed (printed html to output): $html = ob_get_contents();
then save $html to a file and call ob_end_flush();
Re: simple caching script needed
You should have a look at Zend_Cache, especially on the second chapter: the theory of caching. http://framework.zend.com/manual/en/zend.cache.html