如何在 Drupal 8 中以编程方式清除缓存? [英] How to clear cache programmatically in Drupal 8?

查看:24
本文介绍了如何在 Drupal 8 中以编程方式清除缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个 Drupal 8 站点上工作.这个网站正在运作.我最近搬到了另一台机器上.

I am working on a Drupal 8 site. This site was working. I recently moved to another machine.

它显示如下错误:

Recoverable fatal error: Argument 1 passed to 

DrupalComponentDependencyInjectionContainer::__construct() must be of

 the type array, boolean given, called in [DRUPAL-

PATH]/core/lib/Drupal/Core/DrupalKernel.php on line 883 and defined in 

[DRUPAL-PATH]/core/lib/Drupal/Component/DependencyInjection/Container.php

 on line 119 #0 [DRUPAL-PATH]/core/includes/bootstrap.inc(550): 

_drupal_error_handler_real(4096, 'Argument 1 pass...', 

'/Applications/M...', 119, Array)

我需要以编程方式清除缓存.

I need to clear cache programmatically.

推荐答案

通过 SQL

TRUNCATE `cache_bootstrap`;
TRUNCATE `cache_config`;
TRUNCATE `cache_container`;
TRUNCATE `cache_data`;
TRUNCATE `cache_default`;
TRUNCATE `cache_discovery`;
TRUNCATE `cache_dynamic_page_cache`;
TRUNCATE `cache_entity`;
TRUNCATE `cache_menu`;
TRUNCATE `cache_render`;
TRUNCATE `cache_rest`;
TRUNCATE `cachetags`;
TRUNCATE `cache_toolbar`;

Drush

drush cr all

这篇关于如何在 Drupal 8 中以编程方式清除缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆