Cache_Lite::get() -- Test if a cache is available and (if yes) return it
Opis
One of the main method of Cache_Lite : test the validity of a cache file
and return it if it's available (FALSE else)
Parametr
- string
$group
name of the cache group
- boolean
$doNotTestCacheValidity
if set to TRUE, the cache validity won't be tested
Zwracana wartość
returns data of the cache (or false if no cache available)
Uwagi
Ta funkcja nie może być wywołana
statycznie.
Przykład
Przykład 32-1. Usage
<?php
require_once "Cache/Lite.php";
$options = array(
'cacheDir' => '/tmp/',
'lifeTime' => 7200,
'pearErrorMode' => CACHE_LITE_ERROR_DIE
);
$cache = new Cache_Lite($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)
// (...)
}
?>
|
|