Cache_Lite::extendLife
Cache_Lite::extendLife() – Extend the life of a valid cache file
Synopsis
require_once 'Cache/Lite.php';
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.
Throws
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);
?>