Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

On development platform caching can be a pain. Can I turn it off and will it affect any of the modules that require it?

share|improve this question

8 Answers

up vote 15 down vote accepted

Install the devel module which adds a cache clear option for administrators. You'll find a devel block to add to a region for quick cache clearing, or if you install the admin menu and get a quick menu in the top left for clearing various caches in Drupal.

If you like the command line install drush and use the drush cc all command to clear your sites caches. Beware that currently drush cc doesn't clear the Varnish cache if that's applicable to your setup.

share|improve this answer

If you are using Drupal 7 you can always set your caching to using DrupalFakeCache, which is normally only used during the installation process. To set that, drop the following code snippet in your settings.php:

include_once(DRUPAL_ROOT . '/includes/cache.inc');
include_once(DRUPAL_ROOT . '/includes/cache-install.inc');
$conf['cache_default_class'] = 'DrupalFakeCache';
share|improve this answer

'Performance' page in administration > site configuration will allow you to enable / disable caching of selected site elements. Theme templates are typically cached more persistently but can be flushed within the same 'performance' page.

'Administration menu' module will provide a shortcut in a toolbar if cache flushes need to be done more regularly - during theme dev I find myself constantly flushing.

share|improve this answer

In addition to the methods Steve H mentioned, using the Devel module opens up a few more options, including:

  • Rebuilding the theme cache on every page load (useful if you're a themer working on template files)
  • A block that'll provide easy access to the empty cache function and reinstall function.

With the Devel module and caching turned off under Performance, the only other major cache you'll run into in routine development is the menu router, which can be rebuilt either using Devel or Admin Menu as Steve mentioned.

share|improve this answer
ah good shout, left that bit out :) – Steve H Mar 2 '11 at 22:39

One important thing to note is that if you have a lot of stylesheets (either from your theme or from modules), then turning off CSS file optimizing has the potential to break your site in IE.

While not actually caching, it's on the same settings page and is often used with caching.

The "Flush all caches" link in the admin menu module is fantastic, by the way.

share|improve this answer
If you are worried about IE you can use drupal.org/project/ie_css_optimizer – realityloop Mar 3 '11 at 0:42

As far as I know there aren't any modules that require caching. If you don't want to turn it off you can clear it in the Site Settings > Performance section.

Even with caching disabled Drupal won't recognise new files added to themes until you clear the cache.

There's a some information on different ways to clear the cache over at Drupal.org

share|improve this answer

If you're using Drupal 6, the "Cache Disable" module can be handy for that task if you do not wish [for some reason] to install heavier modules like Devel.

share|improve this answer

Old question, but I just saw it popped up as a related one to a search I was doing.

Nearly all of the cache clearing methods end up calling drupal_flush_all_caches in the end. You can play around with calling this in various circumstances in your own code.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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