1] How to work/flow applyWithoutApp() in magento? (Magento ver. 1.13.0.2)Class : Enterprise_PageCache_Model_Container_Abstract

/** Generate placeholder content before application was initialized and apply to page content if possible
     * @param string $content
     * @return bool **/
     public function applyWithoutApp(&$content)[Line No : 1]
     {
        $cacheId = $this->_getCacheId(); [Line No : 2]

        if ($cacheId === false) {
        	       $this->_applyToContent($content, ''); [Line No : 3]
            return true;
        }

        $block = $this->_loadCache($cacheId);[Line No : 4]
        if ($block === false) {
	   return false;
        }

        $block = Enterprise_PageCache_Helper_Url::replaceUenc($block); [Line No : 5]
        $this->_applyToContent($content, $block);[Line No : 6]
        return true;
    }

Purpose of function applyWithoutApp() :

This function generate placeholder content before application was initialized and apply to page content if possible
applyWithoutApp($content) function loads page without initialize application, it means that loads page using full page cache processor and check placeholder for a block in it. Using placeholder the processor identify the container class for dynamic block.

The container then load the dynamic block contents from the block cache, using the cache key by using
$cacheId = $this->_getCacheId();

If a cache key is already present, the container class replaces the placeholder in the $content with the cached block output.

Stack for applyWithoutApp() :

#1
Enterprise_PageCache_Model_Container_Welcome[Enterprise_PageCache_Model_Container_Abstract]
#000000005c8265da000000003e10428d#->applyWithoutApp(‘

#2
Enterprise_PageCache_Model_Processor#000000005c8265c5000000003e10428d#->_processContainers(‘

#3
Enterprise_PageCache_Model_Processor#000000005c8265c5000000003e10428d#->_processContent(‘

#4
Enterprise_PageCache_Model_Processor#000000005c8265c5000000003e10428d#->extractContent(false)
called at [app\code\core\Mage\Core\Model\Cache.php:687]

#5
Mage_Core_Model_Cache#000000005c8265c1000000003e10428d#->processRequest()
called at [app\code\core\Mage\Core\Model\App.php:340]

#6
Mage_Core_Model_App#000000005c8265ce000000003e10428d#->run(array(‘scope_code’ => ”, ‘scope_type’ => ‘store’, ‘options’ => array())) called at [app\Mage.php:683]

#7
Mage::run(”, ‘store’) called at [index.php:87]</pre>

Sample data for function : applyWithoutApp() for container welcome
[Line No : 1]
$content =

some content……….

<p class="welcome-msg"><!--{WELCOME container="Enterprise_PageCache_Model_Container_Welcome" block="Mage_Page_Block_Html_Welcome" cache_id="bf3668918d4f26657cdbfe6550c62f39a86211ba" cache_lifetime="86400" template=""}--></p>
<!--{ACCLINKS container="Enterprise_PageCache_Model_Container_Accountlinks" block="Mage_Page_Block_Template_Links" cache_id="Grbage value" name="account.links"}-->   some content...................................
 <!--{TOPMENU container="Enterprise_PageCache_Model_Container_Catalognavigation" block="Mage_Page_Block_Html_Topmenu" cache_id="510818704096752f3d371689bb64670a96512ce8" cache_lifetime="86400" template="page/html/topmenu.phtml" name="catalog.topnav" entity_key="3" short_cache_id="0de4e9e52fcff2d0a7df0817ff9cbc84"}-->
</p> 
 <!--{GLOBAL_MESSAGES container="Enterprise_PageCache_Model_Container_Messages" block="Mage_Core_Block_Messages" cache_id="ef4266def0c9e841338aa82b69f010e6fbfb6079" cache_lifetime="86400" storage_types="a:1:{i:0;s:12:"core/session";}"}-->               
 <!--{MESSAGES container="Enterprise_PageCache_Model_Container_Messages" block="Mage_Core_Block_Messages" cache_id="d93e00dc8ae59b9af1eca8a2f0658338b59289c3" cache_lifetime="86400" storage_types="a:4:{i:0;s:12:"core/session";i:1;s:15:"catalog/session";i:2;s:16:"checkout/session";i:3;s:16:"customer/session";}"}-->
Some Content....

[Line No : 2]
$cacheId = CONTAINER_WELCOME_869f0fe9239266819f6e4d38252b4cb2

[Line No : 3]
Default welcome msg!

[Line No : 4]
<p class=”welcome-msg”><!–{WELCOME_8e20186cee9cf7a5a5d1e0bc75ddfec3}–>Default welcome msg!<!–/{WELCOME_8e20186cee9cf7a5a5d1e0bc75ddfec3}–></p>

[Line No : 5]
$block = Enterprise_PageCache_Helper_Url::replaceUenc($block);

class Enterprise_PageCache_Helper_Url

/**
     * Calculate UENC parameter value and replace it
     *
     * @param string $content
     * @return string
     */
    public static function replaceUenc($content)
    {
        $urlHelper = new Mage_Core_Helper_Url;
        $search = '/\/(' . Mage_Core_Controller_Front_Action
                                    ::PARAM_NAME_URL_ENCODED . ')\/[^\/]*\//';
        $replace = '/$1/' . $urlHelper->getEncodedUrl() . '/';
        $content = preg_replace($search, $replace, $content);
    return $content;
    }

The above function removes the container pattern and give HTML of welcome container
<p class=”welcome-msg”>Default welcome Msg!</p>

Flowchart of function applyWithoutApp() :

magento fpc applyWithoutApp function