I'd like to punch a hole in the full page cache for the top menu of a site. While digging through some Enterprise code, I see that the top menu has an existing hole punched:
// app/code/coe/Enterprise/PageCache/etc/cache.xml
<catalog_navigation>
<block>page/html_topmenu</block>
<name>catalog.topnav</name>
<placeholder>TOPMENU</placeholder>
<container>Enterprise_PageCache_Model_Container_Catalognavigation</container>
<cache_lifetime>86400</cache_lifetime>
</catalog_navigation>
However, I'd like to change the cache_lifetime to be much shorter (1 second). What is the best way to modify the cache_lifetime without modifying core code?
1 Answer 1
I believe that if you declare a custom module as <depends> on <Enterprise_PageCache/> and create a cache.xml file which contains the following, you will effectively override the core cache_lifetime value:
<?xml version="1.0"?>
<cache>
<catalog_navigation>
<cache_lifetime>1</cache_lifetime>
</catalog_navigation>
</cache>
-
1Shouldn't catalog_navigation be wrapped in :<config><placeholders>?MagePsycho– MagePsycho2015年08月02日 11:01:31 +00:00Commented Aug 2, 2015 at 11:01
<cache_lifetime />you will get what you want. FWIW I can't imagine such dynamism to be good for the user or for search engines, but obviously I don't know your use case.