| 
<?php
 error_reporting(E_ALL);
 ini_set('display_error', true);
 
 include dirname(dirname(__FILE__))."/Cacheme/Cacheme.php";
 
 $dsn = array(
 /*'memcache://127.0.0.1:11211',*/
 
 'sqlite://'.dirname(__FILE__).DIRECTORY_SEPARATOR.'CacheStorage/cache.sqlite',
 /*    'eaccelerator://',
 */
 /*        'xcache://',*/
 /*    'apc://',
 'file://'.dirname(__FILE__).DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, array('CacheStorage','FileCache')),
 
 */
 
 );
 
 
 class Test{
 public function __construct(){
 $this->var = rand(0,1000);
 }
 
 public function showme(){
 return $this->$var;
 }
 }
 
 $variables = array(
 '1'=>range(0,2),
 '2'=>'string is a string, life is life',
 '3'=>new Test()
 );
 
 
 
 
 foreach($dsn as $i) {
 echo "<h1>CACHE TEST</h1>";
 $c = CacheMeLoader::Factory($i);
 $c->lifetime = 100;
 
 // store in separete cache cell a list of cached variables
 // for delating - works with memcache and xcache
 $c->list = false;
 
 
 
 foreach($variables as $k=>$v){
 echo "<hr>";
 
 
 var_dump($v);
 
 
 // set this variable to cache
 $c->set($k, $v);
 
 // check is this variable cached
 if (!$c->is_cached($k)){
 $c->set($k, $v);
 }
 
 
 
 // get this variable from cache
 var_dump($c->get($k, $v));
 
 // clear specified variable
 $c->clear($k);
 
 var_dump('Nothing heppens right?', $c->get($k, $v));
 
 
 }
 
 //clear all cache
 var_dump($c->clear());
 
 }
 
 
 
 ?>
 
 |