| 1 | <?php |
||
| 14 | class AddHeaderCacheListener implements CacheListener |
||
| 15 | { |
||
| 16 | /** @var string */ |
||
| 17 | private $headerName; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param string $headerName |
||
| 21 | */ |
||
| 22 | public function __construct($headerName = 'X-Cache') |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Called before the cache plugin returns the response, with information on whether that response came from cache. |
||
| 29 | * |
||
| 30 | * @param RequestInterface $request |
||
| 31 | * @param ResponseInterface $response |
||
| 32 | * @param bool $fromCache Whether the `$response` was from the cache or not. |
||
| 33 | * Note that checking `$cacheItem->isHit()` is not sufficent to determine this. |
||
| 34 | * @param CacheItemInterface|null $cacheItem |
||
| 35 | * |
||
| 36 | * @return ResponseInterface |
||
| 37 | */ |
||
| 38 | public function onCacheResponse(RequestInterface $request, ResponseInterface $response, $fromCache, $cacheItem) |
||
| 42 | } |
||
| 43 |