Magento缓存操作命令

阅读导航

后台缓存操作

后台菜单 system > tools > Cache Management 可以直接管理magento的缓存

查看Magento的缓存状态

$ bin/magento cache:status
Current status:
                        config: 1
                        layout: 1
                    block_html: 1
                   collections: 1
                    reflection: 1
                        db_ddl: 1
               compiled_config: 1
                           eav: 1
         customer_notification: 1
            config_integration: 1
        config_integration_api: 1
                     full_page: 1
             config_webservice: 1
                     translate: 1
                        vertex: 1

上面列出了当前magento系统里全部的缓存类型和对应的状态, 0关闭/1开启

开启Magento缓存

bin/magento cache:enable [type] … [type] #多个type用空格分开

例如:

$ bin/magento cache:enable config
Changed cache status:
                        config: 0 -> 1
Cleaned cache types:
config

关闭Magento缓存

bin/magento cache:disable [type] … [type] #多个type用空格分开

例如:

$ bin/magento cache:disable config
Changed cache status:
                        config: 1 -> 0

清空缓存命令

清空指定缓存

bin/magento cache:clean [type] ... [type]
bin/magento cache:flush [type] ... [type]

清空全部缓存

bin/magento cache:flush

参考链接: https://devdocs.magento.com/guides/v2.3/config-guide/cli/config-cli-subcommands-cache.html#config-cli-subcommands-cache-clean-over