<?php
require_once "Cache/Lite.php";
$options = array(
'cacheDir' => '/tmp/',
'lifeTime' => 7200,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);
$id = 'foo';
if (!($data = $cache->get($id))) {
// the cache is not hit !
$data = '123456789';
$cache->save($data);
} else {
// the cache is hit !
if (isset($_GET['extend'])) {
$cache->extendLife();
}
}
echo($data);
?> |