[[prevent-cache-clear]]

=== Clearing the Cache

[role="summary"]
How to clear the cache using Drush or the user interface.

(((Cache,clearing)))
(((Cache,rebuilding)))

==== Goal

Clear or rebuild your site's internal caches to ensure they are up-to-date with
the most recent data, using the user interface or Drush.

==== Prerequisite knowledge

* <<prevent-cache>>
* <<install-tools>>

==== Site prerequisites

If you want to use Drush to clear the cache, Drush must be installed. See
<<install-tools>>.

==== Steps

You can use the administrative interface or Drush to clear the cache. You can
also use the rebuild script or Drush to do a more complete cache rebuild.

===== Using the administrative interface to clear the cache

. In the _Manage_ administrative menu, navigate to _Configuration_ >
_Development_ > _Performance_ (_admin/config/development/performance_). If you
cannot access this page in the administrative interface, use one of the other
methods to clear or rebuild the cache.

. Click _Clear all caches_.

. A message saying the cache has been cleared appears at the top of
the page.

. If this doesn't resolve the problem that caused you to want to clear the
cache, try a rebuild instead.

===== Using the rebuild script

. Open _settings.php_ (_/sites/default/settings.php_) in any plain text
editor. Add this line to the end of the file and save it:
+
----
$settings['rebuild_access'] = TRUE;
----

. Visit _http://www.example.com/core/rebuild.php_ in your browser (where
_www.example.com_ is your site's URL). After a short pause, you should be
redirected to the home page of your site, and the cache should be rebuilt.

. Open _settings.php_ (_/sites/default/settings.php_) in a text editor. Find the
line you added with _$settings['rebuild_access']_, remove this line, and save
the file.

===== Using Drush to rebuild or clear the cache

You can use one of two commands:

* Use the command `drush cache-rebuild` to clear and rebuild all cached data
for a site. After running this command, you will see the output message "Cache
rebuild complete."

* Use the command `drush cc` to see a list of individual caches and then
choose the specific cache you would like to clear. Running this command should
produce output like the following:
+
----
> drush cc
Enter a number to choose which cache to clear.
 [0]  :  Cancel
 [1]  :  drush
 [2]  :  theme-registry
 [3]  :  menu
 [4]  :  css-js
 [5]  :  block
 [6]  :  module-list
 [7]  :  theme-list
 [8]  :  render
 [9]  :  views
----
Choose a cache to clear by entering the number associated with that cache. Press
"Enter" to continue.


//==== Expand your understanding


//==== Related concepts

==== Videos

// Video from Drupalize.Me.
video::https://www.youtube-nocookie.com/embed/-evRieC6Y3U[title="Clearing the Cache"]

==== Additional resources

https://www.drupal.org/docs/7/administering-drupal-7-site/clearing-or-rebuilding-drupals-cache[_Drupal.org_ community documentation page "Clearing or rebuilding Drupal's cache"]


*Attributions*

Adapted and edited by https://www.drupal.org/u/eojthebrave[Joe Shindelar]
and https://www.drupal.org/u/jerseycheese[Jack Haas] from
https://www.drupal.org/docs/7/administering-drupal-7-site/clearing-or-rebuilding-drupals-cache["Clearing or
rebuilding Drupal's cache"],
copyright 2000-2017 by the individual contributors to the
https://www.drupal.org/documentation[Drupal Community Documentation].
