Skip to content

Commit

Permalink
Merge pull request #770 from joomlatools/feature/769-cache
Browse files Browse the repository at this point in the history
Cache not working correctly for pages with custom cache time
  • Loading branch information
johanjanssens authored Jun 16, 2021
2 parents baa0415 + e540922 commit ef7cc11
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions code/dispatcher/behavior/cacheable.php
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,13 @@ public function isCacheable($strict = true)
if($result && $strict)
{
//Check if the current page is cacheable
if($page = $this->getPage()) {
$result = (bool)$page->process->get('cache', true);
} else {
$result = false;
if($page = $this->getPage())
{
if($page->process->get('cache', true) === false) {
$result = false;
}
}
else $result = false;

//Failsafe in case an error got cached
if($cache = $this->loadCache()) {
Expand Down Expand Up @@ -558,6 +560,8 @@ protected function _encodeEtag(array $validators)
protected function _decodeEtag($etag)
{
$validators = array();

$etag = ltrim($etag, 'W/'); //strip W/ before decoding
if($etag && $data = base64_decode($etag)) {
$validators = json_decode(gzinflate($data), true);
}
Expand Down

0 comments on commit ef7cc11

Please # to comment.