---
title: "Speeding up Drupal cache flushing"
date: 2015-04-21
updated: 2026-09-26
canonical: https://michaelshadle.com/2015/04/21/speeding-up-drupal-cache-flushing
---

# Speeding up Drupal cache flushing

Are your cache clears slow?

Do you use features? It's great, but can become quite the beast when you run a `drush cc all` or a `drush fra` - and today we figured out why the `drush cc all` is an issue. Because when `hook_flush_caches()` runs, if you don't explicitly define this as `FALSE`, it will run the `fra` for you inside of your cache clear!

Add this to your `settings.php`:

```php
$conf['features_rebuild_on_flush'] = FALSE;
```

Since we run our `fra` separately, we've disabled this, and noticed quite a reduction in time to "flush caches" (which was not only flushing caches but also reverting features, apparently!)

It's that unknown-to-us-before-today variable in the snippet below...

```php
/**
 * Implements hook_flush_caches().
 */
function features_flush_caches() {
  if (variable_get('features_rebuild_on_flush', TRUE)) {
    features_rebuild();       
    // Don't flush the modules cache during installation, for performance reasons.
    if (variable_get('install_task') == 'done') {
      features_get_modules(NULL, TRUE);
    }
  }
  return array();
}
```
