Skip to content

Commit

Permalink
FIX: better caching
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnysideup committed Feb 26, 2024
1 parent ad3fadd commit fe986ea
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/Extensions/ControllerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,28 @@ public function onBeforeInit()
if (Versioned::LIVE !== Versioned::get_stage()) {
return;
}
/** PageController|ControllerExtension $owner */
$owner = $this->getOwner();
if ($owner instanceof ContentController) {
$extend = $owner->extend('updateCacheControl');
if($extend) {
return;
}
if($owner->param('Action')) {
return;
}
if($owner->param('ID')) {
return;
}
if($owner->request->isAjax()) {
return;
}
if($owner->request->getVar('flush')) {
return;
}
if($owner->request->requestVars()) {
return;
}
$dataRecord = $owner->dataRecord;
if (empty($dataRecord)) {
return;
Expand All @@ -48,8 +68,6 @@ public function onBeforeInit()
->publicCache(true)
->setMaxAge($cacheTime)
;
} else {
return null;
}
}
}
Expand Down

0 comments on commit fe986ea

Please sign in to comment.