Cache_Lite::remove

Cache_Lite::remove() – キャッシュファイルを削除する

Synopsis

require_once 'Cache/Lite.php';

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

Description

与えられたキャッシュファイル (ID とグループで識別される) を削除します。

Parameter

string $id

キャッシュIDを指定します

string $group

キャッシュグループ名を指定します

Return value

returns 問題がなければ true

Note

This function can not be called statically.

Example

使用法

<?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')) {

    
// キャッシュがヒットした !
    // [あり得ない !]

} else {

    
// 有効なキャッシュが見つからなかった (このページを生成し保存する必要がある)
    
$data '<html><head><title>test</title></head><body><p>this is a test</p></body></html>';
    
$cache->save($data);

}

?>

これはダミーの例です。 なぜなら、キャッシュがスクリプトの最初で削除されているからです ! そのため、if 文の最初のケースはあり得ません。