Skip to content

Commit

Permalink
Add "cacheable" param to distinguish between FPC vs non-FPC routes
Browse files Browse the repository at this point in the history
  • Loading branch information
sdesmet committed Apr 12, 2018
1 parent 8bc39a4 commit 117cb52
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/code/community/Mpchadwick/PageCacheHitRate/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function handleControllerFrontSendResponseBefore(Varien_Event_Observer $o
$params = $paramProvider->baseParams(true) + array(
'type' => $type,
'route' => $this->trackerRoute(),
'cacheable' => $this->isRequestCacheable()
);

$factory = Mage::getModel('mpchadwick_pagecachehitrate/trackerFactory');
Expand All @@ -40,6 +41,20 @@ public function handleControllerFrontSendResponseBefore(Varien_Event_Observer $o
}
}

/**
* Determine this request is cacheable in FPC
*
* @return bool
*/
protected function isRequestCacheable()
{
$request = Mage::app()->getRequest();
$processor = Mage::getSingleton('enterprise_pagecache/processor');
$subprocessor = $processor->getMetadata('cache_subprocessor');

return $subprocessor !== null && $processor->canProcessRequest($request);
}

/**
* Get the type of response.
*
Expand Down

0 comments on commit 117cb52

Please sign in to comment.