This class can be used to cache the output of PHP generated pages in files.
It can capture the output of a PHP script section and cache it by storing the output in files.
The output data is cached for a given timeout period. While the cache does not expire, the data is retrieved from the cache file.
The cache file path and the timeout period are configurable.
It can capture the output of a PHP script section and cache it by storing the output in files.
The output data is cached for a given timeout period. While the cache does not expire, the data is retrieved from the cache file.
The cache file path and the timeout period are configurable.
Simple usage :
PHP Code:
<?php
include "nen.class.php";
$path = 'cache/'; // We set cache path ! Do not forget '/'
$cache_adv = new nencache;
$cache_name='page1'; //
$cache_time = '3600'; // (3600s = 1h :D )
if ($cache_adv -> start ($cache_name,$cache_time,$path)) {
///my normal page content here
$cache_adv -> build ($path);
}
?>
DO not include dinamic ads (e.g. from admob) in this code , because will be cached ..and is not good
An way to add dinamic ads in cached files can be the usage of some text e.g. [top_admob_ad]
and on output replace this with admob function :-?
If you have a better (or not) cache class , please post here .
Comment