Skip to content

Commit 117cb52

Browse files
committed
Add "cacheable" param to distinguish between FPC vs non-FPC routes
1 parent 8bc39a4 commit 117cb52

File tree

1 file changed

+15
-0
lines changed
  • app/code/community/Mpchadwick/PageCacheHitRate/Model

1 file changed

+15
-0
lines changed

app/code/community/Mpchadwick/PageCacheHitRate/Model/Observer.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function handleControllerFrontSendResponseBefore(Varien_Event_Observer $o
2525
$params = $paramProvider->baseParams(true) + array(
2626
'type' => $type,
2727
'route' => $this->trackerRoute(),
28+
'cacheable' => $this->isRequestCacheable()
2829
);
2930

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

44+
/**
45+
* Determine this request is cacheable in FPC
46+
*
47+
* @return bool
48+
*/
49+
protected function isRequestCacheable()
50+
{
51+
$request = Mage::app()->getRequest();
52+
$processor = Mage::getSingleton('enterprise_pagecache/processor');
53+
$subprocessor = $processor->getMetadata('cache_subprocessor');
54+
55+
return $subprocessor !== null && $processor->canProcessRequest($request);
56+
}
57+
4358
/**
4459
* Get the type of response.
4560
*

0 commit comments

Comments
 (0)