Cache Clearing and rebuilding methods for Drupal 8 | Drupal 8

Cache Clearing and rebuilding methods for Drupal 8

Submitted by editor on Wed, 05/25/2016 - 09:55

What are the methods for clearing or rebuilding Drupal 8 cache, using site url, drush SQL ... ?

Site URL

1. Go to Administration > Configuration > Development > Performance
2. Click on "Clear all caches"


drush cache-rebuild
drush cr

Programmatically using PHP (From a drupal module) 

db_query("DELETE FROM {cache};");

By SQL / phpMyAdmin interface

Clear all tables that start with cache_ (CAUTION : Do not DELETE tables)
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_toolbar;

Run update.php

Running update.php (/update.php) is another way of clearing the cache.
If you cannot login or have no user 1 rights you will need to set in :
$update_free_access = TRUE;  

Do not forget to set this back to FALSE afterwards.


Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.