Determining the cache

The ecrire/public/cacher.php file is used for managing the files stored in the cache.

The cacher() function retrieves the name and date of a cached page if it exists, depending on the context that has been provided. If it is also passed a file address, then the cache file is created.

As such, this function can be called in 2 ways:

  • the first time to determine the name of the cache file and to indicate if a valid cache exists for the requested page.
  • a second time when there is no valid cache. The page is then calculated by the parametrer() function, and then the cacher() function is called, this time to store the results in the cache.
  1. // This function is used twice
  2. $cacher = charger_fonction('cacher', 'public');
  3. // The last four parameters are modified by the function:
  4. // location, validity, and, if valid, contents & age
  5. $res = $cacher($GLOBALS['contexte'], $use_cache, $chemin_cache, $page, $lastmodified);

Download

Author Mark Baber Published : Updated : 01/06/10

Translations : English, français