So I just found out the establishment of a system cache in php, but I need to understand one thing . I have an index.php
file and I included this file has two files cache-top.php
and cache-bottom.php
and I generate an index.html
file , I also change the name of my file index.php
in first.php
to fall on the index.html
page when you enter the site. The system works well because I have a file that is generated, but I feel that the index.html file does not change after 2min as I configured in the "cache -top" file for refresh the content of index.html
must refresh the page first.php
and wanted to know if this is normal ? and what is a solution for the index.html
file to refresh its content without refreshing first.php
?
cache-top.php code :
$expireTime = time () -120 ;
$caching = FALSE ;
$cacheFile = "index.html";
If( file_exists($cacheFile) ) {
if (filemtime($cacheFile) < $expireTime) {
ob_start();
} else {
$caching = TRUE ;
readfile($cacheFile);
}
} else {
ob_start() ;
}
thank you in advance