<?php
/**
 * Demonstration code for Fragment Cache
 */

require_once(__DIR__ . '/FragmentCache.php');

class FragmentCacheSimple extends Fragment
{
	public function getOutput()
	{
		return 'Three.';
	}
}




// cache some text for 60 seconds
if (!FragmentCache::beginCache('test_hello', 60)) {

	echo 'One.';

	FragmentCache::endCache();
}

// cache some text forever; the cache id is derived from the filename and the linenumber in the file
if (!FragmentCache::beginCache()) {

	echo 'Two.';

	FragmentCache::endCache();
}



// test the class based cache
$html = FragmentCache::getCache('FragmentCacheSimple');

echo $html;

?>

