테레빈유가 내 "헤더" 블록을 캐싱하는 것을 중지하고 페이지 캐시만 사용하는 방법은 무엇입니까?
-
13-12-2019 - |
문제
내 header.phtml
, 첫 페이지별 HTML(H1
태그) 아래 $this->getIsHomePage()
상태.난 이게 필요해 H1
첫 페이지에만 표시됩니다.
문제는:테레빈유 하에서는 이 H1
태그는 모든 페이지에 나타납니다.저는 Turpentine이 전체 사이트에 대한 블록을 캐시하기 때문이라고 생각합니다.
기본적으로, turpentine_esi.xml
다음과 같은 구성이 있습니다 header
차단하다:
<!--
A default Magento site includes a logged in user's name in the welcome
message and the number of items in the shopping cart so it must be
cached per-client.
-->
<reference name="header">
<action method="setEsiOptions">
<params>
<access>private</access>
<flush_events>
<wishlist_item_save_after/>
<wishlist_item_delete_after/>
<sales_quote_save_after/>
</flush_events>
</params>
</action>
</reference>
헤더 템플릿에 로그인 정보가 없으므로 header
구성을 차단하거나 구성을 재정의합니다. local.xml
).
제가 생각할 수 있는 해결책은 다음과 같습니다.캐시하지 마세요 header
테레빈유로 차단하고 전체 페이지 HTML로 캐시하세요.그래서 이 부분을 삭제했습니다. turpentine_esi.xml
.
문제는:H1 블록은 여전히 모든 페이지에 렌더링됩니다.
나는 varnish, php5-fpm을 다시 시작했고 Magento를 물리적으로 삭제했습니다. var/cache
, 플러시된 블록, ESI 블록 및 관리자의 페이지 HTML 캐시...여전히 잘못된 버전의 헤더 템플릿이 표시됩니다. H1
모든 페이지에.
다른 방법으로, 나는 그것을 바꾸려고 노력했다. header
캐싱 옵션 public
- 이것도 도움이 되지 않았습니다:
<reference name="header">
<action method="setEsiOptions">
<params>
<access>public</access>
</params>
</action>
</reference>
저는 마젠토 1.9.0.1을 사용하고 있습니다.
해결책
결국, 나는 header
차단하다 turpentine_esi.xml
~에 app/design/frontend/base/default/layout/local.xml
.나의 local.xml
:
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="header">
<action method="setEsiOptions">
</action>
</reference>
<!-- We at Tahta.com.ua only need to cache the cart block. -->
<reference name="top_cart_block">
<action method="setEsiOptions">
<params>
<access>private</access>
<flush_events>
<wishlist_item_save_after/>
<wishlist_item_delete_after/>
<sales_quote_save_after/>
</flush_events>
</params>
</action>
</reference>
</default>
</layout>
다른 팁
<reference name="header">
<action method="setEsiOptions">
<params>
<access>private</access>
</params>
</action>
</reference>
또한 이 링크를 참고해주세요 https://rajeshganjeer.wordpress.com/2014/05/28/varnish-with-magento-terpentine/