Skip to main content
Drupal 8

Main navigation

  • Home
    • Question And Answer
    • NEWS
    • Projects
  • Tutorials - Drupal
    • Android
    • Other
User account menu
  • Log in

Breadcrumb

  1. Home

Cache Clearing and rebuilding methods for Drupal 8

By editor , 25 May, 2016
Question

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
 (/admin/config/development/performance)
2. Click on "Clear all caches"

Drush

drush cache-rebuild
OR
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)
Ex:
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 :
/sites/default/settings.php
$update_free_access = TRUE;  

Do not forget to set this back to FALSE afterwards.

...

Tags

  • Drupal 8
  • Code
  • Server
  • Drush
  • Cache
Drupal 8 Tags based cache system
Drupal 8 Cache API
Cache Drupal 8 Render Arrays

Comments

Plain text

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

Links

  • Drupal.org
  • Drupal core release cycle
  • Drupal events with ease
  • Unit test with Drupal using PHPUnit (Drupal 10)
  • Tokens for file upload url
  • Tips for Docker
  • CKEditor inline image files usage for custom forms.
  • Install Docker on Linux Mint
  • Install PHP 8.1
  • Drupal Security Best Practices
  • Order and sort items with tabledrag
  • Add a custom service YAML container
  • Apply a patch with composer