Magento从数据库中禁用缓存

Kos*_*nos 16 magento

有一种方法可以从System->Cache Management菜单中禁用缓存.

如果不使用数据库SQL查询进入网站,我怎么能这样做呢?

Kos*_*nos 32

禁用缓存的最简单方法是使用SQL查询:

UPDATE `core_cache_option` SET value=0;
Run Code Online (Sandbox Code Playgroud)

并清除您的缓存文件夹只是为了确保:

rm -rf <YOUR SITE PATH HERE>/magento/var/cache/*
Run Code Online (Sandbox Code Playgroud)

在Magento Enterprise Edition中,您还必须清除full_page_cache目录(感谢BartoszGórski):

rm -rf [YOUR SITE PATH HERE]/magento/var/full_page_cache/*
Run Code Online (Sandbox Code Playgroud)


liy*_*kat 6

如果您不想登录网站,只需使用以下脚本即可

<?php

$mageFilename = 'app/Mage.php';

require_once $mageFilename;

umask(0);
Mage::app('admin');

Mage::app()->cleanAllSessions();
Mage::app()->getCacheInstance()->flush();
Mage::app()->cleanCache();

$types = Array(
          0 => 'config', 
          1 => 'layout',
          2 => 'block_html', 
          3 => 'translate', 
          4 => 'collections',
          5 => 'eav',
          6 => 'config_api',
          7 => 'fullpage',
          8=>'config_api2'
        );

 $allTypes = Mage::app()->useCache();

$updatedTypes = 0;
foreach ($types as $code) {

    if (!empty($allTypes[$code])) {

        $allTypes[$code] = 0;
        $updatedTypes++;

    }
    $tags = Mage::app()->getCacheInstance()->cleanType($code);
}
if ($updatedTypes > 0) {
    Mage::app()->saveUseCache($allTypes);
    echo "Caches disabled Programmatically";
}
else {
    echo "Caches disabled Already";
}
Run Code Online (Sandbox Code Playgroud)

只需创建自己的脚本,即可完成缓存部分

希望这一定会对你有所帮助.