How do I completely disable cache?

2020-07-03 07:17发布

问题:

Drupal 6's cache can be set to disabled, normal or aggressive. I cannot find these options for my Drupal 7 installation. There is only a button that flushes all the cache but it has to be clicked for every change I made to a module or a template. By change I mean adding some HTML tags to a module or a template.

Thanks to mirzu's response, I already installed the devel module but it doesn't work either. The only way I get so see my changes is by disabling and enabling the module.

The hello.module looks like:

function annotate_menu() {
  $items = array();
  $items['hello'] = array(
    'title'            => t('Hello world'),
    'page callback'    => 'hello_output',
    'access arguments' => array('access content'),
  );

  return $items;
}

function hello_output() {
  header('Content-type: text/plain; charset=UTF-8');
  header('Content-Disposition: inline');
  return 'annotate';
}

The template page-hello.tpl.php contains print $content;.

I access the page through http://localhost/test/hello.

回答1:

Completely disable the cache and use the devel module and check the box that reads "rebuild the cache registry on each page load."



回答2:

There are many different levels of caching involved.

  • The menu system is not actually a cache. If you change anything in hook_menu(), you need to rebuild it. devel.module provides a handy link for that in the development block.

  • Additionally, Drupal also caches hook implementation and many other things, which you can clear with another link in the development block or if you have drush installed, with "drush cc all". There is also a way to disable it completely but that could make your site quite slow: http://drupal.org/node/797346



回答3:

In Drupal 7, you can check the 'Rebuild the theme registry on every page load' option in the configuration page (admin/config/development/devel) of the Devel module.