previousconstructor Cache_Lite::Cache_Lite (Previous) (Next) Cache_Lite::savenext

View this page in Last updated: Sun, 18 Oct 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

Cache_Lite::get

Cache_Lite::get() – Teste si un cache est disponible et (si oui) le retourne

Synopsis

require_once 'Cache/Lite.php';

string Cache_Lite::get ( string $id , string $group = 'default' , boolean $doNotTestCacheValidity = = false )

Description

Un des méthodes principales de Cache_Lite : tester la validité d'un fichier de cache et le retourner s'il est disponible (FALSE sinon)

Parameter

string $id

identifiant de cache

string $group

nom du groupe de cache

boolean $doNotTestCacheValidity

si définie à TRUE, la validitié du cache ne sera pas testée

Return value

Retourne les données du cache (ou FALSE si aucun cache n'est disponible)

Note

This function can not be called statically.

Example

Utilisation

<?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 présent !
   // Le contenu est dans la variable $data
   // (...)

} else {

   
// Aucun cache n'est disponible (vous devez réaliser et sauvegarder la page)
   // (...)

}

?>
previousconstructor Cache_Lite::Cache_Lite (Previous) (Next) Cache_Lite::savenext

Download Documentation Last updated: Sun, 18 Oct 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.