Conditions | 5 |
Paths | 7 |
Total Lines | 22 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | public function handle(Request $request, Closure $next): Response |
||
23 | { |
||
24 | if ($this->responseCache->enabled($request)) { |
||
25 | if ($this->responseCache->hasBeenCached($request)) { |
||
26 | event(new ResponseCacheHit($request)); |
||
27 | |||
28 | return $this->responseCache->getCachedResponseFor($request); |
||
29 | } |
||
30 | } |
||
31 | |||
32 | $response = $next($request); |
||
33 | |||
34 | if ($this->responseCache->enabled($request)) { |
||
35 | if ($this->responseCache->shouldCache($request, $response)) { |
||
36 | $this->responseCache->cacheResponse($request, $response); |
||
37 | } |
||
38 | } |
||
39 | |||
40 | event(new CacheMissed($request)); |
||
41 | |||
42 | return $response; |
||
43 | } |
||
44 | } |
||
45 |