2012-09-27 28 views

回答

4

不,只是意味着它需要刷新。

在Magento中,每當您對產品,靜態塊等進行更改時,它都會識別數據庫中的數據不再與緩存中的數據相同。不幸的是,Magento沒有實現什麼緩存數據是不同的,只是東西是不同的。

您需要進入系統>高速緩存管理並刷新無效的高速緩存類型。

如果您願意,您可以將其設置爲自動刷新。

創建一個模塊(或使用現有模塊),您可以使用該模塊來設置用於刷新緩存的cron作業。創建一個文件:{命名空間}/{}模塊名/Model/Observer.php

在這個文件中:

<?php 
class <namespace>_<modulename>_Model_Observer { 

    public function refreshCache() { 
    try { 
     $allTypes = Mage::app()->useCache(); 
     foreach($allTypes as $type => $blah) { 
     Mage::app()->getCacheInstance()->cleanType($type); 
     } 
    } catch (Exception $e) { 
     // do something 
     error_log($e->getMessage()); 
    } 
    } 

} 

在你的模塊等/ config.xml中:

<config> 
    ... 
    <crontab> 
    <jobs> 
     <{modulename}_refresh_cache> 
     <schedule><cron_expr>* * * * *</cron_expr></schedule> 
     <run><model>{modulename}/observer::refreshCache</model></run> 
     </{modulename}_refresh_cache> 
    </jobs> 
    </crontab> 
    ... 
</config> 

現在,作爲只要cron在您的服務器上正確配置,緩存將自動更新,就像cron運行一樣。