I mean all of the caching options under admin/settings/performance. I frequently use drush sql-sync to keep my development copy up-to-date with the server. However, the server must have all of the caches turned on, obviously.

So I wonder: must I visit admin/settings/performance every time I update my db? Or is there a Drush script for that?

  • 1
    just a brief explanation: chx answer is the best since all it takes is 'drush en cache_disable --yes'. GApple comes really close, since it solves the problem once and for all, though it might hurt newbies. doublejoice actually proposes a drush script, and is a wonderful answer to my question, although the other two are even better. Commented Mar 16, 2011 at 15:59

6 Answers 6


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.

  • i'll give it a look and see if i can patch it. thanks a lot for the tip :) Commented Mar 15, 2011 at 17:50

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 also exclude your settings.php file from the repository your pushing code up to production with and add these settings... $conf = array( 'cache' => FALSE, //page cache 'block_cache' => FALSE, //block cache 'preprocess_css' => FALSE, //optimize css 'preprocess_js' => FALSE, //optimize javascript 'environment' => 'development' );
    – doublejosh
    Commented Nov 8, 2011 at 18:51
  • More recommendations... $conf['cache'] = 0; $conf['page_cache_maximum_age'] = 0; $conf['block_cache'] = FALSE; $conf['preprocess_css'] = FALSE; $conf['preprocess_js'] = FALSE; $conf['views_skip_cache'] = TRUE;
    – doublejosh
    Commented Feb 20, 2014 at 0:51

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.


You could always use a drush aliases file on your dev server and set it up to skip the cache tables when you run sql-sync. The following would create aliases for your local dev server and your remote live server:

$aliases['dev'] = array(
    'root' => '/var/www/devroot',

$aliases['live'] = array(
    'root' => '/var/www/liveroot',
    'remote-host' => 'www.mysite.com',
    'remote-user' => 'exampleuser',
    'command-specific' => array (
       'sql-sync' => array (
         'skip-tables-list' => 'cache,cache_menu',

If you saved that under your home directory at:


then you can call your sql-sync command like so:

drush sql-sync @mysite.live @mysite.dev

and it should skip the cache tables (obviously I only listed 2 there, but you could put anything in there, I even add watchdog in).

For more info on aliases and all the various options, check out the example file in your drush install at drush/examples/example.aliases.drushrc.php

As a last note for anyone who trys to use sql-sync, I had authentication issues when I first ran it, so if someone attempts this and gets errors about public/private keys then do the following:

drush dl drush_extras
drush pushkey @mysite.live
drush @mysite.live status

The pushkey command from drush_extras creates a private/public key pair and pushes the public key to the live server. The last command is just to check that it worked.

  • thanks, the answer is wonderful. but my issue is that my development environment should have the caches turned off and i want to avoid visitting admin/settings/performance every time i update. Commented Oct 12, 2011 at 19:40

I have written a drush command which enables / disables all the following options:


Examples and code can be found here: http://ourlife01.blogspot.gr/2015/05/drush-command-to-enabledisable-cache.html

So in order to disable all of the above options, you just have to run:

drush cache-disable

The command:

drush cache-enable

is the same as setting the variables to the values:

cache: TRUE
cache_lifetime: 1 minute
page_cache_maximum_age: 1 hour
preprocess_css: TRUE
preprocess_js: TRUE
  • That's very nice, but it does have its own opinion when it comes to re-enable cache. Maybe it would be better to save the previous value when disabling caches or just asking the user through a CLI prompt. Commented May 26, 2015 at 20:12
  • You are right @barraponto, I modified the script and I added help as well. New command is drush cache-enable min max. Check the above URL.
    – cyberp
    Commented May 27, 2015 at 19:47
  • New version enables/disables the block cache as well..
    – cyberp
    Commented May 27, 2015 at 19:57
  • awesome. what's stopping you from publishing it in drupal.org? Commented May 27, 2015 at 20:44
  • Time! I don't know how to do it :)
    – cyberp
    Commented May 28, 2015 at 9:44

Also you can disable cache by below line, put it in settings.php files

$conf['display_cache_disable'] = TRUE;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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