Output.php
2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
namespace Phalcon\Cache\Frontend {
/**
* Phalcon\Cache\Frontend\Output
*
* Allows to cache output fragments captured with ob_* functions
*
*<code>
*
* //Create an Output frontend. Cache the files for 2 days
* $frontCache = new Phalcon\Cache\Frontend\Output(array(
* "lifetime" => 172800
* ));
*
* // Create the component that will cache from the "Output" to a "File" backend
* // Set the cache file directory - it's important to keep the "/" at the end of
* // the value for the folder
* $cache = new Phalcon\Cache\Backend\File($frontCache, array(
* "cacheDir" => "../app/cache/"
* ));
*
* // Get/Set the cache file to ../app/cache/my-cache.html
* $content = $cache->start("my-cache.html");
*
* // If $content is null then the content will be generated for the cache
* if ($content === null) {
*
* //Print date and time
* echo date("r");
*
* //Generate a link to the sign-up action
* echo Phalcon\Tag::linkTo(
* array(
* "user/signup",
* "Sign Up",
* "class" => "signup-button"
* )
* );
*
* // Store the output into the cache file
* $cache->save();
*
* } else {
*
* // Echo the cached output
* echo $content;
* }
*</code>
*/
class Output implements \Phalcon\Cache\FrontendInterface {
protected $_buffering;
protected $_frontendOptions;
/**
* \Phalcon\Cache\Frontend\Output constructor
*
* @param array $frontendOptions
*/
public function __construct($frontendOptions=null){ }
/**
* Returns cache lifetime
*
* @return integer
*/
public function getLifetime(){ }
/**
* Check whether if frontend is buffering output
*
* @return boolean
*/
public function isBuffering(){ }
/**
* Starts output frontend
*/
public function start(){ }
/**
* Returns output cached content
*
* @return string
*/
public function getContent(){ }
/**
* Stops output frontend
*/
public function stop(){ }
/**
* Prepare data to be stored
*
* @param mixed $data
* @return mixed
*/
public function beforeStore($data){ }
/**
* Prepares data to be retrieved to user
*
* @param mixed $data
* @return mixed
*/
public function afterRetrieve($data){ }
}
}