1 | <?php |
||
17 | class BackendDecorator extends AbstractDecorator implements BackendInterface |
||
18 | { |
||
19 | /** |
||
20 | * @param BackendInterface $backend |
||
21 | * @param ProfilerInterface $profiler |
||
22 | */ |
||
23 | 15 | public function __construct(BackendInterface $backend, ProfilerInterface $profiler) |
|
28 | |||
29 | /** |
||
30 | * @return string |
||
31 | */ |
||
32 | 15 | public function getComponentName() |
|
38 | |||
39 | /** |
||
40 | * Starts a cache. The $keyname allows to identify the created fragment |
||
41 | * |
||
42 | * @param int|string $keyName |
||
43 | * @param int $lifetime |
||
44 | * @return mixed |
||
45 | */ |
||
46 | 1 | public function start($keyName, $lifetime = null) |
|
50 | |||
51 | /** |
||
52 | * Stops the frontend without store any cached content |
||
53 | * |
||
54 | * @param boolean $stopBuffer |
||
55 | * @return mixed |
||
56 | */ |
||
57 | 1 | public function stop($stopBuffer = null) |
|
61 | |||
62 | /** |
||
63 | * Returns front-end instance adapter related to the back-end |
||
64 | * |
||
65 | * @return mixed |
||
66 | */ |
||
67 | 1 | public function getFrontend() |
|
71 | |||
72 | /** |
||
73 | * Returns the backend options |
||
74 | * |
||
75 | * @return array |
||
76 | */ |
||
77 | 1 | public function getOptions() |
|
81 | |||
82 | /** |
||
83 | * Checks whether the last cache is fresh or cached |
||
84 | * |
||
85 | * @return boolean |
||
86 | */ |
||
87 | 1 | public function isFresh() |
|
91 | |||
92 | /** |
||
93 | * Checks whether the cache has starting buffering or not |
||
94 | * |
||
95 | * @return boolean |
||
96 | */ |
||
97 | 1 | public function isStarted() |
|
101 | |||
102 | /** |
||
103 | * Sets the last key used in the cache |
||
104 | * |
||
105 | * @param string $lastKey |
||
106 | * @return mixed |
||
107 | */ |
||
108 | 1 | public function setLastKey($lastKey) |
|
112 | |||
113 | /** |
||
114 | * Gets the last key stored by the cache |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | 1 | public function getLastKey() |
|
122 | |||
123 | /** |
||
124 | * Returns a cached content |
||
125 | * |
||
126 | * @param int|string $keyName |
||
127 | * @param int $lifetime |
||
128 | * @return mixed |
||
129 | */ |
||
130 | 1 | public function get($keyName, $lifetime = null) |
|
134 | |||
135 | /** |
||
136 | * Stores cached content into the file backend and stops the frontend |
||
137 | * |
||
138 | * @param int|string $keyName |
||
139 | * @param string $content |
||
140 | * @param int $lifetime |
||
141 | * @param boolean $stopBuffer |
||
142 | * @return mixed |
||
143 | */ |
||
144 | 1 | public function save($keyName = null, $content = null, $lifetime = null, $stopBuffer = null) |
|
148 | |||
149 | /** |
||
150 | * Deletes a value from the cache by its key |
||
151 | * |
||
152 | * @param int|string $keyName |
||
153 | * @return boolean |
||
154 | */ |
||
155 | 1 | public function delete($keyName) |
|
159 | |||
160 | /** |
||
161 | * Query the existing cached keys |
||
162 | * |
||
163 | * @param string $prefix |
||
164 | * @return array |
||
165 | */ |
||
166 | 1 | public function queryKeys($prefix = null) |
|
170 | |||
171 | /** |
||
172 | * Checks if cache exists and it hasn't expired |
||
173 | * |
||
174 | * @param string $keyName |
||
175 | * @param int $lifetime |
||
176 | * @return boolean |
||
177 | */ |
||
178 | 1 | public function exists($keyName = null, $lifetime = null) |
|
182 | |||
183 | /** |
||
184 | * Immediately invalidates all existing items. |
||
185 | * |
||
186 | * @return boolean |
||
187 | */ |
||
188 | 1 | public function flush() |
|
192 | } |
||
193 |