zoukankan      html  css  js  c++  java
  • 麦进斗:在windows系统里面刷新magento2的缓存

    下面的代码以编程方式刷新缓存。它为我工作得很好。

    案例1:外磁

    use MagentoFrameworkAppBootstrap;
    include('../app/bootstrap.php');
    $bootstrap = Bootstrap::create(BP, $_SERVER);
    $objectManager = $bootstrap->getObjectManager();
    
    
    try{
        $_cacheTypeList = $objectManager->create('MagentoFrameworkAppCacheTypeListInterface');
        $_cacheFrontendPool = $objectManager->create('MagentoFrameworkAppCacheFrontendPool');
        $types = array('config','layout','block_html','collections','reflection','db_ddl','eav','config_integration','config_integration_api','full_page','translate','config_webservice');
        foreach ($types as $type) {
            $_cacheTypeList->cleanType($type);
        }
        foreach ($_cacheFrontendPool as $cacheFrontend) {
            $cacheFrontend->getBackend()->clean();
        }
    }catch(Exception $e){
        echo $msg = 'Error : '.$e->getMessage();die();
    }

    案例2:在Magento

    公共功能__construct(
    上下文语境美元,
       程序缓存框架Magento  typelistinterface cachetypelist美元,
       程序缓存框架Magento 前端池cachefrontendpool美元
    ){ 
    家长::__construct(合语境);
    美元-> _cachetypelist = $ cachetypelist;
    美元-> _cachefrontendpool = $ cachefrontendpool;
     } 
     
     
     $类型=阵列('config ','layout ','block_html ','collections ','reflection ','db_ddl ','eav ','config_integration ','config_integration_api ','full_page ','translate ','config_webservice ');
     foreach($类型达型){ 
    美元-> _cachetypelist -> cleantype(合型);
     } 
     foreach(美元-> _cachefrontendpool达cachefrontend){ 
     cachefrontend美元-> getbackend()
    分享提高这个答案
  • 相关阅读:
    HTML音频/视频DOM 参考手册
    HTML5 应用程序缓存 和 视频
    HTML 5 新的Input类型
    快速开发平台消息通知中心之短信发送
    设计模式之单例设计模式
    反射
    多线程之线程安全
    01-sql优化及索引
    多线程之线程状态
    shell/linux定时清理日志文件
  • 原文地址:https://www.cnblogs.com/magento-maijindou/p/5970291.html
Copyright © 2011-2022 走看看