Login   Register  
PHP Classes
elePHPant
Icontem

File: unicache/unicache-config.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Nikos M.  >  Unicache  >  unicache/unicache-config.php  >  Download  
File: unicache/unicache-config.php
Role: Configuration script
Content type: text/plain
Description: Configuration script
Class: Unicache
Cache data in files, APC or Memcached
Author: By
Last change:
Date: 2012-05-30 12:32
Size: 844 bytes
 

Contents

Class file image Download
<?php

$unicache_config
=array(
    
'ttl'        =>    60// one minute cache time to live
    
'cacheType'    =>    'FILE'// file based cache
    
'FILE'        =>     array(
                        
'cacheDir'=>'c:\xampp\htdocs\unicache\cache' // the cache directory
                    
),
    
'MEMCACHED'        =>     array(
                        
'servers'=>array(
                            array(
'host'=>'localhost','port'=>11211,'weight'=>10// memcached servers
                        
)
                    ),
    
'filter_func'=>'my_filter'// user defined post cache filter function
    
'cache_func'=>'my_cache' // user defined function to disable caching
);

// require the cache classes
require_once('unicache-factory.class.php');

// filter content after caching
function my_filter($content)
{
    return 
$content.'<br />FILE '.date('y/m/d, H:i:s'time());
}
// disable caching under certain conditions
function my_cache()
{
    if (isset(
$_GET['foo']))
        return 
false;
    return 
true;
}
?>