[ Index ]
 

Code source de Serendipity 1.2

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/bundled-libs/Cache/Lite/ -> Output.php (source)

   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.3 2005/04/17 21:40:18 fab Exp $
  11  * @author Fabien MARTY <fab@php.net>
  12  */
  13  
  14  require_once(dirname(__FILE__) . '/../Lite.php');
  15  
  16  class Cache_Lite_Output extends Cache_Lite
  17  {
  18  
  19      // --- Public methods ---
  20  
  21      /**
  22      * Constructor
  23      *
  24      * $options is an assoc. To have a look at availables options,
  25      * see the constructor of the Cache_Lite class in 'Cache_Lite.php'
  26      *
  27      * @param array $options options
  28      * @access public
  29      */
  30      function Cache_Lite_Output($options)
  31      {
  32          $this->Cache_Lite($options);
  33      }
  34  
  35      /**
  36      * Start the cache
  37      *
  38      * @param string $id cache id
  39      * @param string $group name of the cache group
  40      * @param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested
  41      * @return boolean true if the cache is hit (false else)
  42      * @access public
  43      */
  44      function start($id, $group = 'default', $doNotTestCacheValidity = false)
  45      {
  46          $data = $this->get($id, $group, $doNotTestCacheValidity);
  47          if ($data !== false) {
  48              echo($data);
  49              return true;
  50          } else {
  51              ob_start();
  52              ob_implicit_flush(false);
  53              return false;
  54          }
  55      }
  56  
  57      /**
  58      * Stop the cache
  59      *
  60      * @access public
  61      */
  62      function end()
  63      {
  64          $data = ob_get_contents();
  65          ob_end_clean();
  66          $this->save($data, $this->_id, $this->_group);
  67          echo($data);
  68      }
  69  
  70  }
  71  
  72  
  73  ?>


Généré le : Sat Nov 24 09:00:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics