Last updated August 4, 2017

Knowing how to clear Drupal's cache is an important skill for any developer. You'll likely find yourself doing it frequently in order to get Drupal to register the changes you make to your code, or other updates you make via the UI. It is also a good first step to trouble shooting problems with your Drupal site: Clear the cache before you do any other debugging to ensure it's not just a bad cache entry.


Learn three methods of clearing Drupal's cache: via the administrative UI, with Drush, and by truncating tables in the database.


There are two common ways to clear Drupal's cache: via the UI, or with Drush.

Clearing the cache via the UI

Go to the Performance administrative page.

Navigate to Configuration > Performance (admin/config/development/performance).

Click the button labeled: Clear all caches Clear all caches

After successfully clearing the cache Drupal should display the message "Caches cleared."

Clearing the cache with Drush

To clear all caches, use the cache-rebuild command: drush cache-rebuild. This will empty all caches and rebuild the data required for Drupal to execute a page request. Alternatively, use the aliased commands drush cr or drush rebuild.

Open a Terminal window and cd to your Drupal site root.

If you're using Drush aliases, you can skip this step.

Run the command 'drush cache-rebuild' or 'drush cr' for short.

Wait for the command to successfully execute and return to your site.

drush cr demo

Reload the page you were working on in your browser.

It might take a bit longer than usual since the cache has been rebuilt.

Drush's cache-clear vs. cache-rebuild: what's the difference?

Before Drupal 8, the common mantra was "drush cc all" aka drush clear-cache. Now, in Drupal 8, it's drush cache-rebuild or drush cr, for short. What's the difference and why the change?

Caching is widespread in Drupal and creates many interdependencies. Improperly or incomplete cache flushing operations can cause the site to fatally error. In order to guarantee that old data is properly flushed and the site stays up and running, drush cache-rebuild both rebuilds or re-bootstraps the Drupal site in addition to clearing the cache. Additionally, the Drush command cache is cleared, since that was one of the caches included in Drupal 7's drush cache-clear command, and Drupal 8's drush cache-rebuild replaces it.

Drush's cache-rebuild command does the following:

  • Clears the APC cache
  • Bootstraps Drupal
  • Calls drupal_rebuild()
  • Clears the Drush cache (to maintain consistency with Drupal 7's drush cache-clear command)

If you'd like to take a peek under the hood of Drush's cache-rebuild function, check out drush/commands/core/, at the end of the file, look at function drush_cache_rebuild().

Truncate cache-related database tables

Another method of clearing the cache is to truncate--or clear all the data from--the cache-related database tables. These are all the tables that begin with "cache_" (after the site-specific table prefix, if there is one).

In a SQL GUI application like Sequel Pro, which is what I like to use, this is easily accomplished by connecting to the server, selecting your site's database, highlighting all of the tables beginning with "cache_", ctrl-clicking and selecting Truncate tables. Confirm that you do when the alert pops up. Other database administrative programs will also have the ability to truncate tables.

Truncate tables with Sequel Pro

Or, from the mysql CLI or a SQL command field in a database administrative tool (like PhpMyAdmin or others), you would run the following:

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;


In this tutorial, you learned three methods for clearing Drupal's cache: via the administrative performance page at admin/config/development/performance, with drush cache-rebuild or drush cr, and by truncating cache_* tables in the database.

Additional resources