1 | <?php |
||
10 | class DelegatingCacheStrategy implements CacheStrategyInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var array |
||
14 | */ |
||
15 | private $requestMatchers = []; |
||
16 | |||
17 | /** |
||
18 | * @var CacheStrategyInterface |
||
19 | */ |
||
20 | private $defaultCacheStrategy; |
||
21 | |||
22 | /** |
||
23 | * DelegatingCacheStrategy constructor. |
||
24 | */ |
||
25 | 1 | public function __construct(CacheStrategyInterface $defaultCacheStrategy = null) |
|
29 | |||
30 | /** |
||
31 | * @param CacheStrategyInterface $defaultCacheStrategy |
||
32 | */ |
||
33 | public function setDefaultCacheStrategy(CacheStrategyInterface $defaultCacheStrategy) |
||
37 | |||
38 | /** |
||
39 | * @param RequestMatcherInterface $requestMatcher |
||
40 | * @param CacheStrategyInterface $cacheStrategy |
||
41 | */ |
||
42 | 1 | final public function registerRequestMatcher(RequestMatcherInterface $requestMatcher, CacheStrategyInterface $cacheStrategy) |
|
49 | |||
50 | /** |
||
51 | * @param RequestInterface $request |
||
52 | * @return CacheStrategyInterface |
||
53 | */ |
||
54 | 1 | private function getStrategyFor(RequestInterface $request) |
|
69 | |||
70 | /** |
||
71 | * @inheritDoc |
||
72 | */ |
||
73 | 1 | public function fetch(RequestInterface $request) |
|
77 | |||
78 | /** |
||
79 | * @inheritDoc |
||
80 | */ |
||
81 | 1 | public function cache(RequestInterface $request, ResponseInterface $response) |
|
85 | |||
86 | /** |
||
87 | * @inheritDoc |
||
88 | */ |
||
89 | public function update(RequestInterface $request, ResponseInterface $response) |
||
93 | } |
||
94 |