问题
I am using TinyBrick's Lightspeed module for whole page caching and am trying to setup Hole Punching.
I'm following the directions at: http://blog.delorumcommerce.com/general/90-percent-lightspeed-traffic-fast-but-i-need-more
I have edited my template's header.phtml so that it contains the snippet:
<!-- TEST HOLE PUNCH -->
<!-- NOCACHE key="topMenuLinks" -->
<?php echo $this->getChildHtml('topCart') ?>
<!-- ENDNOCACHE -->
<!-- END TEST HOLE PUNCH -->
If I visit a page with nothing in my cart the shopping cart element is displayed, with the TEST HOLE PUNCH
comments, but with NOCACHE
removed.
If I view the page's cache file on the server I can see that it contains both the TEST HOLE PUNCH
and NOCACHE
comments, and if I view the page with ?debug_front=1
I see:
success!, I'm about to spit out a cached page, look out.
This seems to be functioning as expected, but if I add an item to the cart ?debug_front=1
replies:
disqualified with cart
valid disqualifiers without hole punch content... bummer
Viewing the page source still shows the TEST HOLE PUNCH
comment, but not the NOCACHE
comment. Surrounding a shopping cart element that accurately reports the number of items in carts
As I understand the blog post, I should be seeing a blank spot where the NOCACHE
comments were surrounded by the TEST HOLE PUNCH
comments.
After reading "valid disqualifiers without hole punch content... bummer"
I thought it might be failing because I didn't attempt to fill the hole.
I added a controller using the example code and am able to navigate to /lightspeedcontent/hole/index
and see:
{"topMenuLinks":"Hello World!"}
And I edited my catalog.xml
and cms.xml
so that all <action method="cachePage">
contain:
<holecontent>lightspeedcontent/hole/index</holecontent>
But I get the same results when visiting the pages with or without items in the cart.
Does anyone have experience with this module? Help would be greatly appreciated.
回答1:
Did you refresh Magento's layout cache in the backend Cache Management tool? The cached layout may not have the tags that you added, leading LightSpeed to believe that you do not have a controller to provide the hole-filling content.
回答2:
I encountered the same problem, but I just got Hole Punching to work on the top links, i.e. it displays 'Hello World!' instead of the links. The only change I made is in the cms.xml and catalog.xml, in the 'disqualifiers' tag I removed everything except 'loggedin' so now when I log in and go back to the home page it displays the 'Hello World!' message.
I realise that this answer is a bit late but it might help someone else searching.
来源:https://stackoverflow.com/questions/7273459/how-do-i-setup-hole-punching-in-tinybricks-lightspeed-for-magento