1 | <?php |
||
10 | final class CacheableResponseCollection implements \IteratorAggregate, ResponseCollectionInterface |
||
11 | { |
||
12 | /** @var CacheItemPoolInterface */ |
||
13 | private $cache; |
||
14 | /** @var CacheKeyStrategyInterface */ |
||
15 | private $keyStrategy; |
||
16 | /** @var array */ |
||
17 | private $items; |
||
18 | /** @var ResponseCollectionInterface */ |
||
19 | private $proxiedCollection; |
||
20 | /** @var int|null */ |
||
21 | private $ttl; |
||
22 | |||
23 | /** |
||
24 | * CacheableResponseCollection constructor. |
||
25 | * |
||
26 | * @param CacheItemPoolInterface $cache |
||
27 | * @param CacheKeyStrategyInterface $keyStrategy |
||
28 | * @param array $items |
||
29 | * @param ResponseCollectionInterface $proxiedCollection |
||
30 | * @param int|null $ttl |
||
31 | */ |
||
32 | 3 | public function __construct( |
|
33 | CacheItemPoolInterface $cache, |
||
34 | CacheKeyStrategyInterface $keyStrategy, |
||
35 | array $items, |
||
36 | ResponseCollectionInterface $proxiedCollection, |
||
37 | $ttl |
||
38 | ) { |
||
39 | 3 | $this->cache = $cache; |
|
40 | 3 | $this->keyStrategy = $keyStrategy; |
|
41 | 3 | $this->items = $items; |
|
42 | 3 | $this->proxiedCollection = $proxiedCollection; |
|
43 | 3 | $this->ttl = $ttl ?: null; |
|
44 | 3 | } |
|
45 | |||
46 | /** {@inheritdoc} */ |
||
47 | 3 | public function getResponse(RpcRequestInterface $request) |
|
65 | |||
66 | /** {@inheritdoc} */ |
||
67 | 1 | public function getIterator() |
|
80 | } |
||
81 |