New records could not hold multiple habtm associates using ::set(). Fixes #160.
[akelos.git] / vendor / pear / Cache_Lite / Lite / Output.php
blob97322736d99990bc14e0cc19e811801a9cba2e14
1 <?php
3 /**
4 * This class extends Cache_Lite and uses output buffering to get the data to cache.
6 * There are some examples in the 'docs/examples' file
7 * Technical choices are described in the 'docs/technical' file
9 * @package Cache_Lite
10 * @version $Id: Output.php,v 1.4 2006/01/29 00:22:07 fab Exp $
11 * @author Fabien MARTY <fab@php.net>
14 require_once('Cache/Lite.php');
16 class Cache_Lite_Output extends Cache_Lite
19 // --- Public methods ---
21 /**
22 * Constructor
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'
27 * @param array $options options
28 * @access public
30 function Cache_Lite_Output($options)
32 $this->Cache_Lite($options);
35 /**
36 * Start the cache
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
44 function start($id, $group = 'default', $doNotTestCacheValidity = false)
46 $data = $this->get($id, $group, $doNotTestCacheValidity);
47 if ($data !== false) {
48 echo($data);
49 return true;
51 ob_start();
52 ob_implicit_flush(false);
53 return false;
56 /**
57 * Stop the cache
59 * @access public
61 function end()
63 $data = ob_get_contents();
64 ob_end_clean();
65 $this->save($data, $this->_id, $this->_group);
66 echo($data);