Cache_Lite::remove

Cache_Lite::remove() – Remove a cache file

Synopsis

require_once 'Cache/Lite.php';

boolean Cache_Lite::remove ( string $id , string $group = 'default' )

Описание

remove the given cache file (specified with its id and group)

Parameter

string $id

cache id

string $group

name of the cache group

Return value

returns true if no problem

Замечание

This function can not be called statically.

Пример

Usage

<?php
require_once "Cache/Lite.php";

$options = array(
    
'cacheDir' => '/tmp/',
    
'lifeTime' => 7200,
    
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($options);

$cache->remove('id_of_the_page');

if (
$data $cache->get('id_of_the_page')) {

    
// Cache hit !
    // [IMPOSSIBLE !]

} else { 
    
    
// No valid cache found (you have to make and save the page)
    
$data '<html><head><title>test</title></head><body><p>this is a test</p></body></html>';
    
$cache->save($data);
    
}

?>

This is a dummy example because the cache is destroyed at the beginning of the script ! So the first case of the if statement is impossible.

    Поддержать сайт на родительском проекте КГБ