Skip to main content

Clear cache in Drupal many ways

Clear cache in Drupal many ways. Here is a guide to some quick ways to clear the cache in Drupal, and it is correct up to the current version which is Drupal 10

Admin UI

Navigate to /admin/config/development/performance 

Then click button "Clear all caches"

Programmatically using PHP

drupal_flush_all_caches();

Use Drush tool

Open terminal and run command

drush cache-rebuild
//or you can use
drush cr

update.php

Run update.php by browser "example.com/update.php" is other way of clearning the cache

Use SQL

Delete all data inside tables that start with prefix table  + "cache_" like this

TRUNCATE devwk_cache_config;
TRUNCATE devwk_cache_container;
TRUNCATE devwk_cache_data;
TRUNCATE devwk_cache_default;
TRUNCATE devwk_cache_discovery;
TRUNCATE devwk_cache_dynamic_page_cache;
TRUNCATE devwk_cache_entity;
TRUNCATE devwk_cache_menu;
TRUNCATE devwk_cache_render;
TRUNCATE devwk_cache_toolbar;

Get the prefix table in the file setting.php

Sản Phẩm

Sản Phẩm & Dịch Vụ Dành cho SME