Drupal - Is there a drush script to disable all caches?

You need to set several variables to turn off caching on your dev site...

 drush vset cache 0
 drush vset preprocess_css 0
 drush vset preprocess_js 0
 drush vset page_cache_maximum_age 0
 drush vset views_skip_cache TRUE

It's even easier if you have conditional config in your settings.php file. Then you can refresh the DB and the changes will stick!

$conf['cache'] = 0; // Page cache $conf['page_cache_maximum_age'] = 0; // External cache TTL $conf['preprocess_css'] = FALSE; // Optimize css $conf['preprocess_js'] = FALSE; // Optimize javascript $conf['views_skip_cache'] = TRUE; // Views caching

... though if you just turn off various caching through the admin UI and clear cache once then you can theme away without turning off the rest... since script it less likely to change.


You can use your settings.php file to explicitly set variables to override your database settings. The values will be locked to whatever is set in the file, and cannot be changed through the admin interface.
At the end of the default file is a section which starts:

/**
 * Variable overrides:
 *
 * To override specific entries in the 'variable' table for this site,
 * set them here. You usually don't need to use this feature. This is
 * useful in a configuration file for a vhost or directory, rather than
 * the default settings.php. Any configuration setting from the 'variable'
 * table can be given a new value. Note that any values you provide in
 * these variable overrides will not be modifiable from the Drupal
 * administration interface.
 *
 * Remove the leading hash signs to enable.
 */
# $conf = array(
#   'site_name' => 'My Drupal site',
#   'theme_default' => 'minnelli',
#   'anonymous' => 'Visitor',

So to disable page, JS, and CSS caching, set cache, preprocess_js, and preprocess_css all to '0'

$conf = array(
  'cache' => '0',
  'preprocess_css' => '0',
  'preprocess_js' => '0',
);

The closing parenthesis for the array declaration is the last line of the default file, after a few more comment blocks, so make sure to uncomment it there rather than adding a new one. Also make sure that you don't have another $conf declaration that will conflict.


https://drupal.org/node/797346 for D7. For D6, https://drupal.org/project/cache_disable but it breaks the form cache. One needs to patch it to fall to DB cache for form caching. And probably update status cache too.

Tags:

Drush