Is there a difference in what caching is cleared between

drush cc all


Admin > Site Configuration > Performance > Clear cached data button



Short answer: There is no significant difference.


function system_clear_cache_submit($form, &$form_state) {
  drupal_set_message(t('Caches cleared.'));


function drush_cache_clear_both() {
  if (drush_has_boostrapped(DRUSH_BOOTSTRAP_DRUPAL_FULL)) {

Both end up calling drupal_flush_all_caches, which clears the standard Drupal caches, cached CSS/JS files, and everything declared by a hook_flush_caches.

drush_cache_clear_both is what is called by 'cc all'. drush_cache_clear_drush clears some drush caches that have no effect on the Drupal site.

| improve this answer | |
  • Doh, I could have checked the source code. Thanks! – Justin Dec 21 '11 at 22:00
  • 2
    Yes, and to go one step further, I will add that checking the source code of Drush is a really good way to find out which Drupal APIs to call for a given function (e.g. if you don't know how to do something in Drupal, but you know that there is a Drush command that does the same thing). I've learned a lot about Drupal this way. – greg_1_anderson Dec 29 '11 at 16:58

There is no difference in source code, but sometimes we get a problem with clearing the cache by running drush cc all that only can be solved by clearing the cache from the admin menu or by dumping the cache tables.

I guess that flushing caches by using the admin menu does ignore those errors while drush doesn't

Those Errors look like this. Caused by a buggy hack in feature.

WD node: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'node-23-23-default' for key 'PRIMARY': INSERT INTO {panelizer_entity} (entity_type, entity_id, revision_id, name, no_blocks, [error] css_id, css, pipeline, contexts, relationships, did, view_mode, css_class, title_element, link_to_entity, extra) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14, :db_insert_placeholder_15); Array

| improve this answer | |

I see only two differences, but rather significant:

  • When I clear caches using GUI, then most of them gets regenerated during my own request, to show me Drupal page again, so everything happens with my credentials.
  • When I clear them using drush, they are regenerated by the first natural request, usually by anonymous user.

This difference is only important during development, but it may hide serious permission/caching issues if forgotten.

On production machines, or when you're developing something that does not cache and does not use permissions, it's not an issue.

  • Cache clear using GUI may sometimes timeuot, if cache is big and database is slow (or just under heavy load)
  • Command Line Interface PHP usually has much longer timeout set, if any at all, so even if cache clear is slow, it will most probably finish without being interrupted.

This difference should not be of importance on a healthy production server, but in perfect world we would never need to clear caches manually anyway.

Usually answer by greg_1_anderson is perfectly good - no significant difference.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.