Full Page Cache: Enterprise PageCache Model Processor Default
How to work/flow Enterprise_PageCache_Model_Processor_Default class in Magento?
(Magento ver. 1.13.0.2)Object:Object: $this =>Enterprise_PageCache_Model_Processor_DefaultFollowing constants is used in above class: No ConstantsFollowing variables is used in above class:
- $_placeholder
- $_noCacheGetParams
- $_allowCache
Some important functions and its purpose in this class:
- allowCache() : It is used for check if request can be cached or not.
- replaceContentToPlaceholderReplacer() : It is used to replace block content to placeholder replacer.
- prepareContent() : It is used prepare response body before caching.
_getPlaceholderReplacer() - getPageIdInApp() : It is used to return cache page id with application. It’s depends on GET super global array.
- getPageIdWithoutApp() : It is used to return cache page id without application. It’s depends on GET super global array.
Functions in class Enterprise_PageCache_Model_Processor_Default
There are 7 functions are present in class Enterprise_PageCache_Model_Processor_Default
- /**Check if request can be cached
* @param Zend_Controller_Request_Http $request
* @return bool **/
public function allowCache(Zend_Controller_Request_Http $request)
{} - /**Replace block content to placeholder replacer
* @param string $content
* @return string **/
public function replaceContentToPlaceholderReplacer($content)
{} - /**Prepare response body before caching
* @param Zend_Controller_Response_Http $response
* @return string **/
public function prepareContent(Zend_Controller_Response_Http $response)
{
return $this->replaceContentToPlaceholderReplacer($response->getBody());
} - /**Retrieve placeholder replacer
* @param array $matches Matches by preg_replace_callback
* @return string **/
protected function _getPlaceholderReplacer($matches)
{
return $this->_placeholder->getReplacer();
} - /**Return cache page id with application. Depends on GET super global array.
* @param Enterprise_PageCache_Model_Processor $processor
* @param Zend_Controller_Request_Http $request
* @return string **/
public function getPageIdInApp(Enterprise_PageCache_Model_Processor $processor)
{
return $this->getPageIdWithoutApp($processor);
} - /**Return cache page id without application. Depends on GET super global array.
* @param Enterprise_PageCache_Model_Processor $processor
* @return string **/
public function getPageIdWithoutApp(Enterprise_PageCache_Model_Processor $processor)
{
$queryParams = $_GET;
ksort($queryParams);
$queryParamsHash = md5(serialize($queryParams));
return $processor->getRequestId() . ‘_’ . $queryParamsHash;
} - /**Get request uri based on HTTP request uri and visitor session state
* @deprecated after 1.8
* @param Enterprise_PageCache_Model_Processor $processor
* @param Zend_Controller_Request_Http $request
* @return string **/
public function getRequestUri(Enterprise_PageCache_Model_Processor $processor,
Zend_Controller_Request_Http $request
) {
}
Variation of sample data for different pages (Homepage, Product Listing Page, Product Info Page)
Variables : These values for Homepage
URL:: https://localhost/oscp-store/mage-ent-test
$_placeholder = Enterprise_PageCache_Model_Container_Placeholder
- $_definitionMap = Array [8]
- [0] WELCOME_8e20186cee9cf7a5a5d1e0bc75ddfec3 = WELCOME
container = “Enterprise_PageCache_Model_Container_Welcome”
block = “Mage_Page_Block_Html_Welcome”
cache_id = “bf3668918d4f26657cdbfe6550c62f39a86211ba”
cache_lifetime = “86400”
template=”” - [1] ACCLINKS_ef551a42665572f16be6f8a990c96b37 = ACCLINKS
container = “Enterprise_PageCache_Model_Container_Accountlinks”
block = “Mage_Page_Block_Template_Links”
cache_id = “b8f9b3383abc7a26a71bfdc86c4a9d5bff6e3693”
cache_lifetime = “86400”
template = “page/template/links.phtml”
links = “garbage value”
name = “account.links” - [2] CART_SIDEBAR_ccd944c424b10c67d0f564f5cd4534e0 = CART_SIDEBAR
container = “Enterprise_PageCache_Model_Container_Sidebar_Cart”
block = “Mage_Checkout_Block_Cart_Sidebar”
cache_id = “3ee95d5974c12590e902688083b2097637487b5d”
cache_lifetime = “86400”
template = “checkout/cart/cartheader.phtml”
item_renders = “default|checkout/cart_item_renderer|
checkout/cart/sidebar/default.phtml|simple|checkout/cart_item_renderer| checkout/cart/sidebar
/default.phtml|grouped|checkout/cart_item_renderer_grouped|checkout/cart/sidebar
/default.phtml|configurable|checkout/cart_item_renderer_configurable|checkout/cart/sidebar
/default.phtml|bundle|bundle/checkout_cart_item_renderer|checkout/cart/sidebar
/default.phtml” - [3] WISHLISTLINKS_2aacb34d580ee7a80664f8eb4e97a5dc = WISHLISTLINKS
container = “Enterprise_PageCache_Model_Container_Wishlistlinks”
block = “Enterprise_Wishlist_Block_Links”
cache_id = “7ac999da79a72413ae6eccac0959315c33f886fa”
cache_lifetime = “86400”
template = “page/template/linksblock.phtml” - [4] TOPMENU_2e941cd52026f0cb6f5bae341c4c9326 = 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″ - [5] GLOBAL_MESSAGES_aae3749ba9c2e308ffa9c240ac185959 = 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”;}” - [6] MESSAGES_3f9737c153d854d9f0c5395ce4cdb394 = 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”;}” - [7] WISHLISTS_ab717b0bfcc6c0c5acca8eb5c9becd44 = WISHLISTS
container = “Enterprise_PageCache_Model_Container_Wishlists”
block = “Enterprise_Wishlist_Block_Behaviour”
cache_id = “1150a5209c9b5890af3d687df7e0d8ea1811b4d9”
cache_lifetime = “86400”
template = “wishlist/behaviour.phtml” - $_definition = WELCOME
container=”Enterprise_PageCache_Model_Container_Welcome”
block=”Mage_Page_Block_Html_Welcome”
cache_id=”bf3668918d4f26657cdbfe6550c62f39a86211ba”
cache_lifetime=”86400″
template=”” - $_name = WELCOME
- $_attributes = Array [5]container = Enterprise_PageCache_Model_Container_Welcome
block = Mage_Page_Block_Html_Welcome
cache_id = bf3668918d4f26657cdbfe6550c62f39a86211ba
cache_lifetime = 86400
template - 2] $_noCacheGetParams = array[2][0] = ___store
[1] = ___from_store - 3] $_allowCache = true;
Variables: These values for Product Info Page
URL: localhost/oscp-store/mage-ent-test/furniture/couch.html
1]*Enterprise_PageCache_Model_Processor_Default*_placeholder = Enterprise_PageCache_Model_Container_Placeholder
-
- $_definitionMap = Array [11]
- [0] WELCOME_8e20186cee9cf7a5a5d1e0bc75ddfec3 = WELCOME
container=”Enterprise_PageCache_Model_Container_Welcome”
block=”Mage_Page_Block_Html_Welcome”
cache_id=”bf3668918d4f26657cdbfe6550c62f39a86211ba”
cache_lifetime=”86400″
template=”” - [1] ACCLINKS_ef551a42665572f16be6f8a990c96b37 = ACCLINKS
container = “Enterprise_PageCache_Model_Container_Accountlinks”
block = “Mage_Page_Block_Template_Links”
cache_id = “b8f9b3383abc7a26a71bfdc86c4a9d5bff6e3693”
cache_lifetime = “86400”
template = “page/template/links.phtml”
links = “garbage value”
name = “account.links” - [2] CART_SIDEBAR_ccd944c424b10c67d0f564f5cd4534e0 = CART_SIDEBAR
container = “Enterprise_PageCache_Model_Container_Sidebar_Cart”
block = “Mage_Checkout_Block_Cart_Sidebar”
cache_id = “3ee95d5974c12590e902688083b2097637487b5d”
cache_lifetime = “86400”
template = “checkout/cart/cartheader.phtml”
item_renders = “default|checkout/cart_item_renderer |checkout/cart/sidebar
/default.phtml|simple|checkout/cart_item_renderer|checkout/cart/sidebar
/default.phtml|grouped|checkout /cart_item_renderer_grouped|checkout/cart/sidebar
/default.phtml|configurable|checkout/cart_item_renderer_configurable|checkout/cart/sidebar
/default.phtml|bundle|bundle/checkout_cart_item_renderer|checkout/cart/sidebar
/default.phtml” - [3] WISHLISTLINKS_2aacb34d580ee7a80664f8eb4e97a5dc = WISHLISTLINKS
container = “Enterprise_PageCache_Model_Container_Wishlistlinks”
block = “Enterprise_Wishlist_Block_Links”
cache_id = “7ac999da79a72413ae6eccac0959315c33f886fa”
cache_lifetime = “86400”
template = “page/template/linksblock.phtml” - [4] TOPMENU_2e941cd52026f0cb6f5bae341c4c9326 = 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” - [5] GLOBAL_MESSAGES_aae3749ba9c2e308ffa9c240ac185959 = 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”;}” - [6] MESSAGES_2d9b70ec2788a50c7b5d527d294316aa = MESSAGES
container = “Enterprise_PageCache_Model_Container_Messages”
block = “Mage_Core_Block_Messages”
cache_id = “276af2b30c8c0eff1b4acb8bdbb81c7b84e5f25b”
cache_lifetime = “86400”
storage_types = “a:4:{i:0;s:12:”core/session”;i:1;s:15:”catalog/session”;i:2;s:11:”tag
/session”;i:3;s:16:”checkout/session”;}” - [7] CATALOG_PRODUCT_ITEM_RELATED_5a667689c9e54713c7cb2496138f2f1e =
CATALOG_PRODUCT_ITEM_RELATED
container = “Enterprise_PageCache_Model_Container_CatalogProductItem”
block = “Enterprise_TargetRule_Block_Catalog_Product_Item”
cache_id = “b473bbb2a3da23a5e0364571bda918d98a31829d”
cache_lifetime = “86400”
template = “targetrule/catalog/product/list/related/item.phtml”
price_block_type_msrp_block = “catalog/product_price”
price_block_type_msrp_template = “catalog/product/price_msrp_item.phtml”
price_block_type_msrp_item_block = “catalog/product_price”
price_block_type_msrp_item_template = “catalog/product/price_msrp_item.phtml”
price_block_type_msrp_noform_block = “catalog/product_price”
price_block_type_msrp_noform_template = “catalog/product/price_msrp_noform.phtml”
price_block_type_bundle_block = “bundle/catalog_product_price”
price_block_type_bundle_template = “bundle/catalog/product/price.phtml”
price_block_type_giftcard_block = “enterprise_giftcard/catalog_product_price”
price_block_type_giftcard_template = “giftcard/catalog/product/price.phtml” - [8] CATALOG_PRODUCT_ITEM_RELATED_1a66a1549364c4f5cc9f573de676881a = CATALOG_PRODUCT_ITEM_RELATED
container = “Enterprise_PageCache_Model_Container_CatalogProductItem”
block = “Enterprise_TargetRule_Block_Catalog_Product_Item”
cache_id = “070c7f140847e6c9bb76ff653d09f0814a90997d”
cache_lifetime = “86400”
template = “targetrule/catalog/product/list/related/item.phtml”
price_block_type_msrp_block = “catalog/product_price”
price_block_type_msrp_template = “catalog/product/price_msrp_item.phtml”
price_block_type_msrp_item_block = “catalog/product_price”
price_block_type_msrp_item_template = “catalog/product/price_msrp_item.phtml”
price_block_type_msrp_noform_block = “catalog/product_price”
price_block_type_msrp_noform_template = “catalog/product/price_msrp_noform.phtml”
price_block_type_bundle_block = “bundle/catalog_product_price”
price_block_type_bundle_template = “bundle/catalog/product/price.phtml”
price_block_type_giftcard_block = “enterprise_giftcard/catalog_product_price”
price_block_type_giftcard_template = “giftcard/catalog/product/price.phtml” - [9] CATALOG_PRODUCT_ITEM_UPSELL_0b4e35643114e3d9781cadb618075194 = CATALOG_PRODUCT_ITEM_UPSELL
container = “Enterprise_PageCache_Model_Container_CatalogProductItem”
block = “Enterprise_TargetRule_Block_Catalog_Product_Item”
cache_id = “ae59f4224240a3ed8971fa48e80b90f3d1bc3696”
cache_lifetime = “86400”
template = “targetrule/catalog/product/list/upsell/item.phtml”
price_block_type_msrp_block = “catalog/product_price”
price_block_type_msrp_template = “catalog/product/price_msrp_item.phtml”
price_block_type_msrp_item_block = “catalog/product_price”
price_block_type_msrp_item_template = “catalog/product/price_msrp_item.phtml”
price_block_type_msrp_noform_block = “catalog/product_price”
price_block_type_msrp_noform_template = “catalog/product
- [0] WELCOME_8e20186cee9cf7a5a5d1e0bc75ddfec3 = WELCOME
/price_msrp_noform.phtml”
price_block_type_bundle_block = “bundle/catalog_product_price”
price_block_type_bundle_template = “bundle/catalog/product/price.phtml”
price_block_type_giftcard_block = “enterprise_giftcard/catalog_product_price”
price_block_type_giftcard_template = “giftcard/catalog/product/price.phtml”
- [10] WISHLISTS_ab717b0bfcc6c0c5acca8eb5c9becd44 = WISHLISTS
container = “Enterprise_PageCache_Model_Container_Wishlists”
block = “Enterprise_Wishlist_Block_Behaviour”
cache_id = “1150a5209c9b5890af3d687df7e0d8ea1811b4d9”
cache_lifetime = “86400”
template = “wishlist/behaviour.phtml” - 2] $_noCacheGetParams = array[2][0] = ___store
[1] = ___from_store - 3] $_allowCache = true;