diff --git a/system/Cache/ResponseCache.php b/system/Cache/ResponseCache.php index 8a3865b3814e..b4c2fe9187fa 100644 --- a/system/Cache/ResponseCache.php +++ b/system/Cache/ResponseCache.php @@ -52,11 +52,6 @@ public function __construct(CacheConfig $config, CacheInterface $cache) $this->cache = $cache; } - public function getTtl(): int - { - return $this->ttl; - } - /** * @return $this */ @@ -90,12 +85,16 @@ public function generateCacheKey($request): string } /** - * Caches the full response from the current request. + * Caches the response. * * @param CLIRequest|IncomingRequest $request */ public function make($request, ResponseInterface $response): bool { + if ($this->ttl === 0) { + return true; + } + $headers = []; foreach ($response->headers() as $header) { diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index 20d788132677..2ff8da02d456 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -527,9 +527,7 @@ protected function handleRequest(?RouteCollectionInterface $routes, Cache $cache // Cache it without the performance metrics replaced // so that we can have live speed updates along the way. // Must be run after filters to preserve the Response headers. - if ($this->pageCache->getTtl() > 0) { - $this->pageCache->make($this->request, $this->response); - } + $this->pageCache->make($this->request, $this->response); // Update the performance metrics $body = $this->response->getBody();