How do I completely disable cache?

27,254

Solution 1

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

Solution 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

Share:
27,254

Related videos on Youtube

jdecuyper
Author by

jdecuyper

I have a Bachelor degree in Sociology and a master degree in Computer Science! I started programming with my Commodore 64 in the nineties and with VB6, ASP and ActionScript around 2002. Today, I mostly build web applications with ASP.NET, MSSQL and Javascript. Over the time, I have proven multiple times being able to adapt to any kind of technology or languages. I always strive to use programming pattern, write reusable code and simplify the user's experience. Cruise Control, SVN and Git occupy a privileged spot in my tool box.

Updated on March 16, 2020

Comments

  • jdecuyper
    jdecuyper about 4 years

    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.

    • Berdir
      Berdir over 13 years
      Define "change", what do you want to update exactly?. Some things are cached but generally, you should be able to change the inside of a function for example and it should update. Are you testing as anonymous user and page caching is enabled maybe? Might also help if you post some code..
  • jdecuyper
    jdecuyper over 13 years
    I did this but it still doesn't refresh anything. Maybe I should completely disable the cache?
  • jdecuyper
    jdecuyper about 13 years
    Thanks, in the end, I had to switch to Drupal 6 (for other reasons) which allows you to disable the cache functionality (inside the performance section).
  • jdecuyper
    jdecuyper about 13 years
    +1, thanks for pointing out the different kinds of cache Drupal manages.
  • liquidcms
    liquidcms about 12 years
    maybe answer above was for an older version of the Devel module? the latest rel (7.x-1.2) does not have the option to "rebuild the cache registry on each page load".
  • Jaime Hablutzel
    Jaime Hablutzel about 12 years
    why drupal doesn´t have a built it option to disable the cache?
  • Eduard Luca
    Eduard Luca almost 12 years
    "rebuild the cache registry on each page load" is actually "rebuild the theme cache registry on each page load", so it's useless.
  • mirzu
    mirzu almost 12 years
    @EduardLuca If you are doing theming it's quite useful.
  • Toaster
    Toaster about 11 years
    This disable cache option didn't show in my devel UI. One can always edit drupal's settings.php file as per drupal.org/node/797346
  • Ryaner
    Ryaner over 10 years
    As of 7.x-1.3 its now called rebuild the theme cache.

Related