Skip to content

Commit

Permalink
Merge pull request #43 from OldStarchy/master
Browse files Browse the repository at this point in the history
Cache page content
  • Loading branch information
hubertusanton authored Oct 1, 2021
2 parents a7e9fb8 + 698c33a commit 47a3d9e
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/SeoObjectExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -811,16 +811,22 @@ public function getNumCharsTitle() {
*/
public function getPageContent()
{
$session = [];
if (Controller::has_curr()) {
$session = Controller::curr()->getRequest()->getSession();
}
$response = Director::test($this->owner->Link(), [], $session);
static $cache = null;

if ($cache === null) {
$session = [];
if (Controller::has_curr()) {
$session = Controller::curr()->getRequest()->getSession();
}
$response = Director::test($this->owner->Link(), [], $session);

if (!$response->isError()) {
return $response->getBody();
if (!$response->isError()) {
$cache = $response->getBody();
} else {
$cache = '';
}
}

return '';
return $cache;
}
}

0 comments on commit 47a3d9e

Please sign in to comment.