1 | <?php |
||
35 | class Cache implements SingletonInterface |
||
36 | { |
||
37 | /** |
||
38 | * This is the phpdoc-tag, which defines, that the response of API-method is cacheable via TYPO3-caching-framework |
||
39 | * |
||
40 | * Syntax: |
||
41 | * The PHPdoc-comment must look like this: |
||
42 | * @restler_typo3cache_expires [expires-in-seconds] |
||
43 | * |
||
44 | * Examples: |
||
45 | * When API-method should be cacheable in TYPO3 for 10 minutes, than the PHPdoc-comment must look like this: |
||
46 | * @restler_typo3cache_expires 600 |
||
47 | * When API-method should be cacheable in TYPO3 for endless time, than the PHPdoc-comment must look like this: |
||
48 | * @restler_typo3cache_expires 0 |
||
49 | * |
||
50 | * @var string |
||
51 | */ |
||
52 | const API_METHOD_TYPO3CACHE_EXPIRES = 'restler_typo3cache_expires'; |
||
53 | |||
54 | /** |
||
55 | * This is the phpdoc-tag, which defines, that the cached response of API-method should be tagged with given tags |
||
56 | * |
||
57 | * Syntax: |
||
58 | * The PHPdoc-comment must look like this: |
||
59 | * @restler_typo3cache_tags [comma-separated-list-of-tags] |
||
60 | * |
||
61 | * Example: |
||
62 | * When response of API-method should be tagged with 'tag_a' and 'tag_b', than the PHPdoc-comment must look like this: |
||
63 | * @restler_typo3cache_tags tag_a,tag_b |
||
64 | * |
||
65 | * @var string |
||
66 | */ |
||
67 | const API_METHOD_TYPO3CACHE_TAGS = 'restler_typo3cache_tags'; |
||
68 | |||
69 | /** |
||
70 | * @var FrontendInterface |
||
71 | */ |
||
72 | private $cache; |
||
73 | |||
74 | /** |
||
75 | * @param CacheManager $cacheManager |
||
76 | */ |
||
77 | 8 | public function __construct(CacheManager $cacheManager) |
|
81 | |||
82 | /** |
||
83 | * @param string $requestMethod |
||
84 | * @param array $apiMethodInfoMetadata |
||
85 | * @return boolean |
||
86 | */ |
||
87 | 3 | public function isResponseCacheableByTypo3Cache($requestMethod, array $apiMethodInfoMetadata) |
|
96 | |||
97 | /** |
||
98 | * cache response |
||
99 | * |
||
100 | * @param string $requestUri |
||
101 | * @param array $requestGetData |
||
102 | * @param array $apiMethodInfoMetadata |
||
103 | * @param string $responseData |
||
104 | * @param $responseFormatClass |
||
105 | * @param array $responseHeaders |
||
106 | */ |
||
107 | 1 | public function cacheResponseByTypo3Cache( |
|
126 | |||
127 | /** |
||
128 | * @param string $requestUri |
||
129 | * @param array $getData |
||
130 | * @return array |
||
131 | */ |
||
132 | 1 | public function getCacheEntry($requestUri, array $getData) |
|
137 | |||
138 | /** |
||
139 | * @param string $requestUri |
||
140 | * @param array $getData |
||
141 | * @return boolean |
||
142 | */ |
||
143 | 2 | public function hasCacheEntry($requestUri, array $getData) |
|
148 | |||
149 | /** |
||
150 | * @param string $tag |
||
151 | */ |
||
152 | 1 | public function flushByTag($tag) |
|
156 | |||
157 | /** |
||
158 | * @param string $requestUri |
||
159 | * @param array $getData |
||
160 | * @return string |
||
161 | */ |
||
162 | 4 | private function buildIdentifier($requestUri, array $getData) |
|
166 | } |
||
167 |