Skip to content

Commit

Permalink
Fix a bug with detecting "max-age"
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevinrob committed Jul 17, 2015
1 parent 85ed5d0 commit 9100544
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/PrivateCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ protected function getCacheObject(ResponseInterface $response)
}

$matches = [];
if (preg_match('/^max-age=([0-9]*)$/', $response->getHeaderLine("Cache-Control"), $matches)) {
// Handle max-age header
return new CacheEntry($response, new \DateTime('+' . $matches[1] . 'seconds'));
foreach ($cacheControlDirectives as $directive) {
$matches = [];
if (preg_match('/^max-age=([0-9]*)$/', $directive, $matches)) {
// Handle max-age header
return new CacheEntry($response, new \DateTime('+' . $matches[1] . 'seconds'));
}
}
}

Expand Down

0 comments on commit 9100544

Please sign in to comment.