• 如何用命令行刷新,启用,禁用Magento2的缓存


    当你使用Magento商店时如何刷新Magento 2中的Cache命令行是基本的常用操作。Magento 2默认有12种缓存类型。在命令行中有5个简单的命令来管理缓存。在这篇文章中,我将逐步向您展示每个命令行。

    我将在这个截图中解释缓存管理

    Magento 2刷新缓存命令行

    刷新Magento 2缓存:

    • 转到Magento根目录
    • 类型:php bin/magento cache:cleanphp bin/magento cache:flush
    • 完成!去你的Magento商店,检查结果。

    在Ubuntu,Centos或Windows中更改当前目录

    • Ubuntu的: cd /var/www/magento2
    • CentOS的: cd /var/www/html/magento2
    • Windows: cd /d/xampp/htdocs/magento2

    在Windows的情况下,假如你安装Xampp在D驱动器。

    在Magento 2中,让我们尝试使用php bin/magento显示命令行指南,它将显示如下:


    Magento CLI version 2

    Usage:
    command [options] [arguments]

    Options:
    –help (-h) Display this help message
    –quiet (-q) Do not output any message
    –verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
    –version (-V) Display this application version
    –ansi Force ANSI output
    –no-ansi Disable ANSI output
    –no-interaction (-n) Do not ask any interactive question

    Available commands:
    help Displays help for a command
    list Lists commands
    admin
    admin:user:create Creates an administrator
    admin:user:unlock Unlock Admin Account

    cache
    cache:clean Cleans cache type(s)
    cache:disable Disables cache type(s)
    cache:enable Enables cache type(s)
    cache:flush Flushes cache storage used by cache type(s)

    在本指南中,我将详细讨论Cache命令行管理。

    检查缓存状态

    首先,通过以下命令行来显示缓存状态:

    1. php bin/magento cache:status

    缓存状态的结果


    Current status:
    config: 1
    layout: 1
    block_html: 1
    collections: 1
    reflection: 1
    db_ddl: 1
    eav: 1
    config_integration: 1
    config_integration_api: 1
    full_page: 1
    translate: 1
    config_webservice: 1

    清理缓存命令行

    1. php bin/magento cache:clean

    通过缓存类型使用命令行清除缓存存储

    缓存存储可能包含其他数据,如服务器缓存。

    1. php bin/magento cache:flush

    关闭缓存命令行

    以下命令将禁用所有缓存类型

    1. php bin/magento cache:disable

    如果你想禁用特定的缓存类型,应该输入命令行

    1. php bin/magento cache:disable CACHE_TYPE

    例如:

    1. php bin/magento cache:disable config

    启用缓存命令行

    它类似于禁用缓存所有类型和特定的缓存类型

    启用所有缓存类型

    1. php bin/magento cache:enable

    启用特定的缓存类型

    1. php bin/magento cache:enable CACHE_TYPE

      1. php bin/magento cache:enable layout
  • 相关阅读:
    python定时任务:apscheduler的使用(还有一个celery~)
    Python定时任务-schedule vs. Celery vs. APScheduler
    结合Django+celery二次开发定时周期任务
    The Django Book 2.0--中文版
    第十二章: 部署Django
    Django扩展自定义manage命令
    使用django-extension扩展django的manage――runscript命令
    Django | 执行项目下指定的脚本
    C语言宏定义技巧——多次包括头文件内容不同
    《Java并发编程实战》第十章 避免活跃性危急 读书笔记
  • 原文地址:https://www.cnblogs.com/pcyy/p/9776972.html
Copyright © 2020-2023  润新知