Login   Register  
PHP Classes
elePHPant
Icontem

File: test_02_nested.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Dragan Bo?njak  >  Cache output and objects  >  test_02_nested.php  >  Download  
File: test_02_nested.php
Role: Example script
Content type: text/plain
Description: Example of nested blocks
Class: Cache output and objects
Cache the output of PHP scripts in files
Author: By
Last change:
Date: 2007-03-28 05:56
Size: 645 bytes
 

Contents

Class file image Download
<?

/*
You can simply nest multiple cache blocks with single Cache object.
Cached blocks are identified using cache file name - always use unique names!
*/

require_once("cache.php");

$path ".";
$cache = new Cache($path);

while(
$cache->save("cache.test_02_part1.tmp",5))
{
    echo(
"<b>This part is executed every 5 seconds</b><br>");
    echo(
date("H:i:s")."<br><br>");
    
    while(
$cache->save("cache.test_02_part2.tmp",10))
    {
        echo(
"<b>This part is executed every 10 seconds</b><br>");
        echo(
date("H:i:s")."<br><br>");
    
    }

}

echo(
"<b>This part is executed every time</b><br>");
echo(
date("H:i:s")."<br>");
    

?>