void Cache_Lite::extendLife (
)
[since Cache_Lite-1.7.0beta2] Extend the life of an existent cache file. The cache file is "touched", so it starts a new lifetime period. See this feature request for more details.
No exceptions thrown.
This function can not be called statically.
Classical use
<?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);
?>