Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Cache_Lite

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /pear/cache/lite/Output.php

Documentation is available at Output.php

  1. <?php
  2.  
  3. /**
  4. * This class extends Cache_Lite and uses output buffering to get the data to cache.
  5. *
  6. * There are some examples in the 'docs/examples' file
  7. * Technical choices are described in the 'docs/technical' file
  8. *
  9. @package Cache_Lite
  10. @version $Id: Output.php,v 1.4 2006/01/29 00:22:07 fab Exp $
  11. @author Fabien MARTY <[email protected]>
  12. */
  13.  
  14. // Check to ensure this file is within the rest of the framework
  15. defined('JPATH_BASE'or die();
  16.  
  17. //require_once('Cache/Lite.php');
  18. jimport('pear.cache.Lite');
  19.  
  20. class Cache_Lite_Output extends Cache_Lite
  21. {
  22.  
  23.     // --- Public methods ---
  24.  
  25.     
  26.     /**
  27.     * Constructor
  28.     *
  29.     * $options is an assoc. To have a look at availables options,
  30.     * see the constructor of the Cache_Lite class in 'Cache_Lite.php'
  31.     *
  32.     * @param array $options options
  33.     * @access public
  34.     */
  35.     function Cache_Lite_Output($options)
  36.     {
  37.         $this->Cache_Lite($options);
  38.     }
  39.  
  40.     /**
  41.     * Start the cache
  42.     *
  43.     * @param string $id cache id
  44.     * @param string $group name of the cache group
  45.     * @param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested
  46.     * @return boolean true if the cache is hit (false else)
  47.     * @access public
  48.     */
  49.     function start($id$group 'default'$doNotTestCacheValidity false)
  50.     {
  51.         $data $this->get($id$group$doNotTestCacheValidity);
  52.         if ($data !== false{
  53.             echo($data);
  54.             return true;
  55.         }
  56.         ob_start();
  57.         ob_implicit_flush(false);
  58.         return false;
  59.     }
  60.  
  61.     /**
  62.     * Stop the cache
  63.     *
  64.     * @access public
  65.     */
  66.     function end()
  67.     {
  68.         $data ob_get_contents();
  69.         ob_end_clean();
  70.         $this->save($data$this->_id$this->_group);
  71.         echo($data);
  72.     }
  73.  
  74. }
  75.  
  76.  
  77. ?>

Documentation generated on Mon, 05 Mar 2007 21:12:22 +0000 by phpDocumentor 1.3.1