Magento仅对cms页面禁用缓存

Magento仅对cms页面禁用缓存,magento,Magento,我的要求是只为cms页面禁用缓存。那么有什么方法可以实现此功能呢?您需要重写/修改Mage\u Cms\u PageControllermodelspreDispatch方法 public function preDispatch() { $cache = Mage::app()->getCacheInstance(); // Tell Magento to 'ban' the use of FPC, can also ban other types such as 'b

我的要求是只为cms页面禁用缓存。那么有什么方法可以实现此功能呢?

您需要重写/修改
Mage\u Cms\u PageController
models
preDispatch
方法

public function preDispatch() {
    $cache = Mage::app()->getCacheInstance();

    // Tell Magento to 'ban' the use of FPC, can also ban other types such as 'block_html'
    $cache->banUse('full_page');

    parent::preDispatch();
}
与重写此控制器相比,更好、更干净、更安全的选择是使用观察者,这些观察者关注以下事件:

controller_action_predispatch
controller_action_predispatch_' . $this->getRequest()
controller_action_predispatch_' . $this->getFullActionName()

有关更多信息,请参阅。

@MageAkash您真的在使用FPC吗?您可以阻止任何类型的缓存,但不仅仅是
full\u page
eg
block\u html