Clear Magento Cache

I am using Magento ver1.6.1. I need to programmatically clear the Magento cache.

Mage::app()->getCache()->clean()

I used the code above, but it did not clear the cache.

+5
source share
4 answers

try it

Mage::app()->cleanCache();
+14
source

This is what you need:

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

Here's how you do it automatically:

http://mikebywaters.wordpress.com/2011/12/09/automatically-refresh-magento-cache/

+14
source

Magento Enterprise ( 1.13), .

, , , , -, . cleanCache Enterprise_PageCache_Model_Observer.

, Magento Guy Oğuz Çelikdemir.

Enterprise_PageCache_Model_Cache::getCacheInstance() ->clean(Enterprise_PageCache_Model_Processor::CACHE_TAG);

, - !

+3

, bash script, .

Magento Cache Syrup - bash script, magento cache, session, reports , sys-admin, , - magento .

script Magento Linux (ubuntu), , Magento, , , Magento . root magento_cache_syrup.sh .

#!/bin/sh
rm -rf /var/www/sl60/var/cache/*
rm -rf /var/www/sl60/var/session/*
rm -rf /var/www/sl60/var/report/*

, magento. "/var/www/sl60" - magento.

, script, .

, , tmp Magento. . , , . , cron , bash script (magento-cache-syrup) 12 .

cronjob bash script 12

0

All Articles