drupaldrupal-7hook-menu

Why does the cache need to be cleared to affect any hook_menu() change?


I create simple module to test hook_menu() function

my_menu()
{
    $item["abc"] = array(
    "title"=> t("abc")
    "page callback"=> "my_page");
    return $item;
}

Whenever I change "title" of item (to "ABC for example"), I wonder why the cache needs to be cleared to take affect.


Solution

  • Because menus are cached for performance reasons. Building the site's menus takes a hefty amount of processing, which would slow down the site if done on every pageview.