The ecrire/public/cacher.php file is used for managing the files stored in the cache.
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.
- // This function is used twice
- $cacher = charger_fonction('cacher', 'public');
- // The last four parameters are modified by the function:
- // location, validity, and, if valid, contents & age
- $res = $cacher($GLOBALS['contexte'], $use_cache, $chemin_cache, $page, $lastmodified);