Cache_Lite_File::get

Cache_Lite_File::get() – Test if a cache is available and (if yes) return it

Synopsis

require_once 'Cache/Lite/File.php';

string Cache_Lite_File::get ( string $id , string $group = 'default' )

Description

test the validity of a cache file and return it if it's available (FALSE else)

Parameter

string $id

cache id

string $group

name of the cache group

Return value

returns data of the cache (or false if no cache available)

Note

This function can not be called statically.

Example

Usage

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

$options = array(
    
'cacheDir' => '/tmp/',
    
'masterFile' => '/home/web/config.xml',
    
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite_File($options);

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

    
// Cache hit !
    // Content is in $data
    // (...)

} else { 
    
    
// No valid cache found (you have to make and save the page)
    // (...)
    
}

?>
Constructor (Previous) Configuration (Next)
Last updated: Thu, 18 Dec 2014 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

There are no user contributed notes for this page.