PHP Classes

File: example_with_buffers.php

Recommend this page to a friend!
  Classes of Pablo Albrecht   Powerful Caching Class   example_with_buffers.php   Download  
File: example_with_buffers.php
Role: Example script
Content type: text/plain
Description: Example of the class using buffers
Class: Powerful Caching Class
Cache arbitrary content in files
Author: By
Last change:
Date: 12 years ago
Size: 908 bytes
 

Contents

Class file image Download
<?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 */