Location: PHPKode > scripts > Powerful Caching Script > example_with_buffers.php
<?php
/**
* http://codelikepandas.com for more coding tuts, snippets and help
* @author: Pablo Albrecht
* @date: 30 January 2011, 04:56 PM
*/

require_once 'CodeLikePandas_final.php';

/**

// Load the caching engine with a simple config array
$config = array(

	// !IMPORTANT: trailing slash's required
	'caching_path' => './cache/',
	
	// We want to cache only components that have a priority of 50 and above.
	'priority_required' => 50
);

*/

// Load the caching engine with the config file
$config = './configuration.php';

$cache = new CacheHandler($config);

// start the buffer
$cache->start_buffer();

// Generate all the content as usual
include("header.php");
include("menu.php");
echo "This is my content";
include("footer.php");

// stop the buffer & save the result
$cache->stop_buffer();
$cache->cache_buffer('homepage buffer',1000);

/* End of file */
Return current item: Powerful Caching Script