Cache_Lite::extendLife
Cache_Lite::extendLife() – Extend the life of a valid cache file
Synopsis
require_once 'Cache/Lite.php';
void Cache_Lite::extendLife (
)
Description
[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.
Throws
No exceptions thrown.
Note
This function can not be called statically.
Example
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);
?>