Your website is attracting a lot of visitor and taking much of your bandwidth? You are the kind of person who submit a lot of content to social bookmarks and get hit by the traffic? Well, you should consider using the cache function provided by PHP. It will save you many downtime and bandwidth by creating a page which will act like an html in content but will still provide the php functions (posting).
The first option is http://www.ilovejackdaniels.com/php/caching-output-in-php/
The first one is a really nice script by Daniel. I loved it. The only problem I had was with
php_value auto_prepend_file /begin_caching.php
php_value auto_append_file /end_caching.php
due to the fact we can’t use these in the .htaccess on the server. But I figured a way you could make it still be working. Here is how.
The user make a page and call it loader.php (for example).
In the .htaccess, you use the following:
RewriteRule ^([a-z]+)$ loader.php?p=$1
This will tranfert to the loader a variable which is the page name. In the loader.php, you use the following:
<?PHP
require_once(”begin_caching.php”);
require_once($_REQUEST["p"]);
require_once(”end_caching.php”);
?>
This way, each time people get on ANY page, they get the loader to add the begin and end cache and loads the page between, without using the use php_value, hope I helped some of you guys
Second option is http://www.devshed.com/c/a/PHP/Output-Caching-with-PHP/
This one is for more advanced programmers because it requires some understanding of the process going on. I’d rather stick to the first option if you’re looking for a good caching without getting too much involvement in the script.
0 Responses to “For your caching needs”