I have been working on a module for Drupal 6.1 and every time I change some code in the file, I have to go back to Administer > Site Configuration > Performance > Clear cached data.

I do NOT have caching turned on.
Caching mode: Disabled
Minimum cache lifetime:
Page compression: Disabled
Block cache: Disabled
Optimize CSS Files: Disabled
Optimize Javascript files: Disabled

Still, I am forced to clear cache with every little module code change. I am just playing with the example node module so it's very basic code. It looks like:

function mytestmodule_node_info() {
 return array(
       'mytestmodule' => array(
       'name' => t('Test'),
       'module' => 'mytestmodule',
       'description' => t("This is a test"),
       'help' => t("Help test"),
       'has_body' => FALSE,
       'title_label' => 'Name your test (for your reference)'
     )
}

The page that I am trying to see the change on is Create Content. I see there is a content type called "Test". Now, If I go into my code and change it to "Test2", and save the file, and I go back and reload the page, it still says "Test". I tried clearing my browser cache. Same. Tried logging out and back in. Same. Tried loading the page on a different browser, still says "Test".

Finally, I go into the "Clear cached data" in the Administer and finally it gets updated to Test2.

What is going on? How can I really TURN OFF caching? I don't want to click that button every time.

Thanks!

Comments

rernst’s picture

But I believe this is intended behavior: some things (module node info, views, etc) are cached no matter what the settings performance.

criznach’s picture

This is probably the menu system's cache, which always caches. Unfortunately it's a fact of life when developing modules. I'd recommend installing the devel module and enabling it's devel block. That adds a quick and easy "empty cache" link for module development.

thorie79’s picture

I see. That is too bad.

I decided to hack around it by modifying menu.inc around line 338:

function menu_execute_active_handler($path = NULL) {
  if (_menu_site_is_offline()) {
    return MENU_SITE_OFFLINE;
  }
  if (variable_get('menu_rebuild_needed', FALSE)) {
    menu_rebuild();
  }

changed by commenting out the rebuild condition:

function menu_execute_active_handler($path = NULL) {
  if (_menu_site_is_offline()) {
    return MENU_SITE_OFFLINE;
  }
  //if (variable_get('menu_rebuild_needed', FALSE)) {
    menu_rebuild();
  //}

Now it rebuilds the menu every time. It's slow, but it's easier for me to develop.

If you know of a better way to handle this, let me know! Gracias.

gpk’s picture

You could temporarily implement hook_init() in your module and

variable_set('menu_rebuild_needed', TRUE));

Boils down to much the same thing really. But perhaps easier to turn menu cacheing on and off this way. You could even make a tiny custom dev module for this with a checkbox "force menu rebuild on each page load" on a settings page .. oh I must be bored ... ;-)

gpk
----
www.alexoria.co.uk

criznach’s picture

cache_clear_all(NULL, 'cache_menu');