1 | <?php declare(strict_types=1); |
||
16 | final class CacheMiddleware implements MiddlewareInterface |
||
17 | { |
||
18 | use DefaultPriorityTrait; |
||
19 | |||
20 | const DEFAULT_GLUE = '/'; |
||
21 | |||
22 | /** |
||
23 | * @var CacheInterface |
||
24 | */ |
||
25 | private $cache; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $key; |
||
31 | |||
32 | /** |
||
33 | * @var RequestInterface |
||
34 | */ |
||
35 | private $request; |
||
36 | |||
37 | /** |
||
38 | * @var bool |
||
39 | */ |
||
40 | private $store = false; |
||
41 | |||
42 | /** |
||
43 | * @var StrategyInterface |
||
44 | */ |
||
45 | private $strategy; |
||
46 | |||
47 | /** |
||
48 | * @param RequestInterface $request |
||
49 | * @param array $options |
||
50 | * @return CancellablePromiseInterface |
||
51 | */ |
||
52 | public function pre(RequestInterface $request, array $options = []): CancellablePromiseInterface |
||
86 | |||
87 | /** |
||
88 | * @param ResponseInterface $response |
||
89 | * @param array $options |
||
90 | * @return CancellablePromiseInterface |
||
91 | */ |
||
92 | public function post(ResponseInterface $response, array $options = []): CancellablePromiseInterface |
||
120 | |||
121 | /** |
||
122 | * @param ResponseInterface $response |
||
123 | * @return PromiseInterface |
||
124 | */ |
||
125 | protected function hasBody(ResponseInterface $response): PromiseInterface |
||
133 | } |
||
134 |