previousCache_Lite::raiseError (Previous) (Next) constructor Cache_Lite_Output::
Cache_Lite_Output
next

View this page in Last updated: Tue, 02 Jun 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

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);

?>
previousCache_Lite::raiseError (Previous) (Next) constructor Cache_Lite_Output::
Cache_Lite_Output
next

Download Documentation Last updated: Tue, 02 Jun 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.