Source code for file /pear/cache/lite/File.php
Documentation is available at File.php
* This class extends Cache_Lite and offers a cache system driven by a master file
* With this class, cache validity is only dependent of a given file. Cache files
* are valid only if they are older than the master file. It's a perfect way for
* caching templates results (if the template file is newer than the cache, cache
* must be rebuild...) or for config classes...
* There are some examples in the 'docs/examples' file
* Technical choices are described in the 'docs/technical' file
* @version $Id: File.php,v 1.3 2005/12/04 16:03:55 fab Exp $
// Check to ensure this file is within the rest of the framework
//require_once('Cache/Lite.php');
// --- Private properties ---
* Complete path of the file used for controlling the cache lifetime
* @var string $_masterFile
* @var int $_masterFile_mtime
// --- Public methods ----
* $options is an assoc. To have a look at availables options,
* see the constructor of the Cache_Lite class in 'Cache_Lite.php'
* Comparing to Cache_Lite constructor, there is another option :
* (...) see Cache_Lite constructor
* 'masterFile' => complete path of the file used for controlling the cache lifetime(string)
* @param array $options options
$options['lifetime'] =
0;
if (isset
($options['masterFile'])) {
return $this->raiseError('Cache_Lite_File : masterFile option must be set !');
* Test if a cache is available and (if yes) return it
* @param string $id cache id
* @param string $group name of the cache group
* @return string data of the cache (or false if no cache available)
function get($id, $group =
'default')
if ($data =
parent::get($id, $group, true)) {