PHP Classes

File: test/test.php

Recommend this page to a friend!
  Classes of Nikos M.   Unicache   test/test.php   Download  
File: test/test.php
Role: Example script
Content typex: text/plain
Description: Example script
Class: Unicache
Store cached data in different storage types
Author: By
Last change:
Date: 2 months ago
Size: 554 bytes
 

Contents

Class file image Download
<?php
require_once(dirname(dirname(__FILE__)) . '/src/php/Unicache.php');

echo
'UNICACHE::VERSION = ' . UNICACHE_Factory::VERSION . PHP_EOL;

$config = array(
   
'cacheType' => 'FILE',
   
'prefix' => 'foo_',
   
   
'FILE' => array(
       
'cacheDir' => dirname(__FILE__).'/cache1' // will be created if it does not exist
   
)
);


$cache = UNICACHE_Factory::getCache($config);

$cache->put('key', 'val', 10);

sleep(2);

$val = $cache->get('key');

print_r(array('val', $val));

sleep(12);

$val = $cache->get('key');

print_r(array('val', $val));