1 | <?php |
||
12 | class CachableBaseComponent extends BaseComponent |
||
13 | { |
||
14 | const DEFAULT_MAXAGE = 'P7D'; |
||
15 | |||
16 | const PARAMETER_CACHABLE = 'cachable'; |
||
17 | const PARAMETER_MAXAGE = 'maxage'; |
||
18 | |||
19 | protected $cachable = true; |
||
20 | protected $maxAge = self::DEFAULT_MAXAGE; |
||
21 | protected $cacheValidity; |
||
22 | protected $cache; |
||
23 | |||
24 | /** |
||
25 | * CachableBaseComponent constructor. |
||
26 | * @param string $template |
||
27 | * @param Request $request |
||
28 | * @param array $parameters |
||
29 | * @param $matchedSitemapItem |
||
30 | */ |
||
31 | public function __construct($template = '', Request $request, $parameters = array(), $matchedSitemapItem) |
||
45 | |||
46 | public function get() |
||
55 | |||
56 | |||
57 | /** |
||
58 | * @return bool |
||
59 | */ |
||
60 | public function isCachable() |
||
64 | |||
65 | /** |
||
66 | * @return bool |
||
67 | */ |
||
68 | public function isCacheValid() |
||
75 | |||
76 | /** |
||
77 | * @return string |
||
78 | */ |
||
79 | public function getMaxAge() |
||
83 | |||
84 | protected function setCacheValidity() |
||
102 | |||
103 | private function createCache($renderedContent) |
||
107 | |||
108 | } |