Wednesday, December 4, 2013

Magento : Full Page Cache


Full Page Cache (FPC) is:
As in every thing that is generated from a script is written to HTML and served next time, improving performance (by reducing load and not having to generate the page for every visit).


In order to understand Magento Full Page Cache, we need to understand what the run function in Mage_Core_Model_App

public function run($params)
    {
        $options = isset($params['options']) ? $params['options'] : array();
        $this->baseInit($options);
        Mage::register('application_params', $params);

        if ($this->_cache->processRequest()) {
            $this->getResponse()->sendResponse();
        } else {
            $this->_initModules();
            $this->loadAreaPart(Mage_Core_Model_App_Area::AREA_GLOBAL, Mage_Core_Model_App_Area::PART_EVENTS);

            if ($this->_config->isLocalConfigLoaded()) {
                $scopeCode = isset($params['scope_code']) ? $params['scope_code'] : '';
                $scopeType = isset($params['scope_type']) ? $params['scope_type'] : 'store';
                $this->_initCurrentStore($scopeCode, $scopeType);
                $this->_initRequest();
                Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
            }

            $this->getFrontController()->dispatch();
        }
        return $this;
    }

Here $this->_cache->processRequest()
line checks if you have defined a caching node like this under app/etc/test.xml

<config>
<global>
<cache>
<request_processors>
<lt>Bd_Fullpagecache_Model_Processor</lt>
</request_processors>
</cache>
</global>
</config>

The next thing that magento does is to find/initialize the class you have defined and it expects that you have an extractContent function defined in your model.

No comments:

Post a Comment